Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small ruff fixes #1177

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GTG/backends/backend_caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ def _get_calendar_tasks(self, calendar: iCalendar):
"""Getting all tasks that has the calendar tag"""
for task in self.datastore.tasks.data:
if CATEGORIES.has_calendar_tag(task, calendar):
yield uid, task
# This line was broken in commit 74bd3f44 - see #1176
yield uid, task # noqa: F821

#
# Utility methods
Expand Down
2 changes: 1 addition & 1 deletion GTG/core/plugins/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def set_bgcolor_func(self, func=None):
NOTE: This function stronglye depend on browser and could be easily
broken by changes in browser code
"""
browser = self.get_browser()
# browser = self.get_browser()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Ruff is complaining about the unused variable. I thought the line went with the below commented out code, so I figured commenting it out made sense?

It may be the wrong thing to do - I didn't check get_browser() for side effects

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks hamster.py which uses api.browser (line 317) but it could just be replaced with get_browser()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment being commented out is that of a variable local to set_bgcolor_func() - not of PluginAPI.browser.

The line being commented out isn't actually doing anything.


# set default bgcolor?
# if func is None:
Expand Down
6 changes: 4 additions & 2 deletions GTG/core/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ def _remove_from_parent_model(self,tag_id: UUID) -> None:
return
model = self.tid_to_children_model[item.parent.id]
pos = model.find(item)
if pos[0]: model.remove(pos[1])
if pos[0]:
model.remove(pos[1])


def _append_to_parent_model(self,tag_id: UUID) -> None:
Expand All @@ -380,7 +381,8 @@ def _append_to_parent_model(self,tag_id: UUID) -> None:
return
model = self.tid_to_children_model[item.parent.id]
pos = model.find(item)
if not pos[0]: model.append(item)
if not pos[0]:
model.append(item)


def add(self, item: Tag, parent_id: Optional[UUID] = None) -> None:
Expand Down