Skip to content

Commit

Permalink
Do second batch of ruff changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bergercookie committed Aug 11, 2024
1 parent b7438cc commit d4b2208
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 26 deletions.
9 changes: 0 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,12 @@ ignore = [
"D203",
"D205",
"D213",
"D301",
"D400",
"D401",
"D415",
"DTZ004",
"DTZ006",
"E501",
"E711",
"E712",
"EM101",
"EM102",
Expand All @@ -255,20 +253,14 @@ ignore = [
"PGH003",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR2004",
"PT006",
"PT009",
"PT012",
"PT018",
"PT027",
"PTH118",
"PTH120",
"PTH123",
"RET503",
"RET504",
"RET505",
"RET508",
"RUF012",
"S101",
"S101",
Expand All @@ -283,7 +275,6 @@ ignore = [
"T201",
"TCH001",
"TCH002",
"TCH003",
"TD002",
"TD003",
"TD004",
Expand Down
3 changes: 2 additions & 1 deletion syncall/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def confirm_before_proceeding():
ans = input("Continue [Y/n] ? ").lower()
if ans in ["y", "yes", ""]:
break
elif ans in ["n", "no"]:

if ans in ["n", "no"]:
error_and_exit("Exiting.")


Expand Down
6 changes: 4 additions & 2 deletions syncall/notion/notion_todo_block.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import annotations

import datetime
from typing import Optional
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
import datetime

from bubop import logger, parse_datetime
from item_synchronizer.types import ID
Expand Down
2 changes: 1 addition & 1 deletion syncall/scripts/tw_asana_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@opts_asana(hidden_gid=False)
@opts_tw_filtering()
@opts_miscellaneous("TW", "Asana")
def main(
def main( # noqa: PLR0915
asana_task_gid: str,
asana_token: str,
asana_workspace_gid: str,
Expand Down
2 changes: 1 addition & 1 deletion syncall/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class GTasksList(TypedDict):


class GTasksItem(TypedDict):
"""Dict part of an item as returned from the Google Tasks Python API on `tasks().get_task()`.
r"""Dict part of an item as returned from the Google Tasks Python API on `tasks().get_task()`.
Example:
-------
Expand Down
5 changes: 3 additions & 2 deletions tests/generic_test_case.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""Test the basic conversions between Google Calendar and TaskWarrior items."""

import os
import unittest
from pathlib import Path


class GenericTestCase(unittest.TestCase):
"""Generic unittest class for the project."""

DATA_FILES_PATH = os.path.join(os.path.dirname(__file__), "test_data")
# DATA_FILES_PATH = os.path.join(os.path.dirname(__file__), "test_data")
DATA_FILES_PATH = Path(__file__).parent / "test_data"

@classmethod
def setUpClass(cls):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def test_fetch_app_configuration(fs, caplog, mock_prefs_manager):
side_B_name="side B",
combination="doesntexist",
)
captured = caplog.text
assert "No such configuration" in captured
captured = caplog.text
assert "No such configuration" not in captured


def test_report_toplevel_exception(caplog):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_asana_task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime

import pytest
from bubop import parse_datetime
from syncall.asana.asana_task import AsanaTask

Expand Down Expand Up @@ -36,7 +37,7 @@ def test_from_raw_task_asserts_keys(self):
copy = valid_raw_task.copy()
copy.pop(key, None)

with self.assertRaises(AssertionError):
with pytest.raises(AssertionError):
AsanaTask.from_raw_task(copy)

def test_from_raw_task_parses_date_and_datetime_fields(self):
Expand Down
7 changes: 5 additions & 2 deletions tests/test_filesystem_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def fs_file_path(request):


@pytest.mark.parametrize(
"fs_file_path,flush_on_instantiation",
(
"fs_file_path",
"flush_on_instantiation",
),
[
("python_path_with_content", "fixture_true"),
("python_path_with_content", "fixture_false"),
Expand Down Expand Up @@ -60,7 +63,7 @@ def test_fs_file_flush_change_title_content(python_path_with_content: Path):
fs_file = FilesystemFile(path=p)
assert fs_file.contents == path_contents
assert fs_file.title == path_title
assert fs_file.id != None
assert fs_file.id is not None

# change contents and title
new_contents = "New contents\nwith a bunch of lines\n🥳🥳🥳"
Expand Down
4 changes: 1 addition & 3 deletions tests/test_tw_asana_conversions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

import yaml
from syncall.asana.asana_task import AsanaTask
from syncall.tw_asana_utils import convert_asana_to_tw, convert_tw_to_asana
Expand All @@ -16,7 +14,7 @@ def get_keys_to_match(self):
)

def load_sample_items(self):
with open(Path(GenericTestCase.DATA_FILES_PATH, "sample_items.yaml")) as fname:
with (GenericTestCase.DATA_FILES_PATH / "sample_items.yaml").open() as fname:
conts = yaml.load(fname, Loader=yaml.Loader)

self.asana_task = conts["asana_task"]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tw_caldav_conversions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from pathlib import Path
from typing import Any

import yaml
Expand All @@ -13,7 +12,7 @@ class TestConversions(GenericTestCase):
"""Test item conversions - TW <-> Caldav Calendar."""

def load_sample_items(self):
with open(Path(GenericTestCase.DATA_FILES_PATH, "sample_items.yaml")) as fname:
with (GenericTestCase.DATA_FILES_PATH / "sample_items.yaml").open() as fname:
conts = yaml.load(fname, Loader=yaml.Loader)

self.caldav_item = conts["caldav_item"]
Expand Down

0 comments on commit d4b2208

Please sign in to comment.