Skip to content

Commit

Permalink
Run pre commit hook
Browse files Browse the repository at this point in the history
This mostly removes trailing whitespace
  • Loading branch information
diegogangl committed Apr 22, 2024
1 parent c59b72c commit e56f8fd
Show file tree
Hide file tree
Showing 78 changed files with 386 additions and 415 deletions.
1 change: 0 additions & 1 deletion .github/workflows/weekly_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ jobs:
bundle: org.gnome.GTG.Devel.flatpak
manifest-path: build-aux/org.gnome.GTG.Devel.json
cache-key: flatpak-builder-${{ github.sha }}

3 changes: 1 addition & 2 deletions GTG/backends/unmaintained/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ and support them.
If you are interested in taking over one of these, let us know in the bug
tracker!

---
---

Evolution synchronization service has dependencies:
* python3-evolution
Expand All @@ -27,4 +27,3 @@ version of Tweety library.

Remember the Milk synchronization service is shipped with a library for RTM api. It has an external dependency:
* python3-dateutil

20 changes: 10 additions & 10 deletions GTG/core/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ def count_tasks(count: dict, tasklist: list):
'closed': {'all': 0, 'untagged': 0},
}

count_tasks(self.task_count['open'],
count_tasks(self.task_count['open'],
self.tasks.filter(Filter.ACTIVE))

count_tasks(self.task_count['closed'],
count_tasks(self.task_count['closed'],
self.tasks.filter(Filter.CLOSED))

count_tasks(self.task_count['actionable'],
count_tasks(self.task_count['actionable'],
self.tasks.filter(Filter.ACTIONABLE))


Expand All @@ -259,7 +259,7 @@ def refresh_tag_stats(self) -> None:

def notify_tag_change(self, tag) -> None:
"""Notify tasks that this tag has changed."""

for task in self.tasks.lookup.values():
if tag in task.tags:
task.notify('icons')
Expand All @@ -280,14 +280,14 @@ def do_first_run_versioning(self, filepath: str) -> None:
"""If there is an old file around needing versioning, convert it, then rename the old file."""

old_path = self.find_old_path(DATA_DIR)

if old_path is not None:
log.warning('Found old file: %r. Running versioning code.', old_path)
tree = versioning.convert(old_path, self)
self.load_data(tree)
self.save(filepath)
os.rename(old_path, old_path + '.imported')

else:
self.first_run(self.data_path)

Expand All @@ -297,13 +297,13 @@ def find_old_path(self, datadir: str) -> Optional[str]:

# used by which version?
path = os.path.join(datadir, 'gtg_tasks.xml')

if os.path.isfile(path):
return path

# used by (at least) 0.3.1-4
path = os.path.join(datadir, 'projects.xml')

if os.path.isfile(path):
return self.find_old_uuid_path(path)

Expand All @@ -315,7 +315,7 @@ def find_old_uuid_path(self, path: str) -> Optional[str]:

with open(path, 'r') as stream:
xml_tree = et.parse(stream)

for backend in xml_tree.findall('backend'):
module = backend.get('module')
if module == 'backend_localfile':
Expand Down
18 changes: 9 additions & 9 deletions GTG/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

def unwrap(row, expected_type):
"""Find an item in TreeRow widget (sometimes nested)."""

item = row.get_item()

while type(item) is not expected_type:
item = item.get_item()

Expand Down Expand Up @@ -58,7 +58,7 @@ def do_match(self, item) -> bool:

else:
return True


class TaskPaneFilter(Gtk.Filter):
__gtype_name__ = 'TaskPaneFilter'
Expand Down Expand Up @@ -90,13 +90,13 @@ def get_children(children: set) -> None:

if tag.children:
get_children(tag.children)

return result


def match_tags(self, task: Task) -> bool:
"""Match selected tags to task tags."""

all_tags = self.expand_tags()
return len(all_tags.intersection(set(task.tags))) >= len(self.tags)

Expand All @@ -108,7 +108,7 @@ def do_match(self, item) -> bool:
show = task.status is Status.ACTIVE
elif self.pane == 'workview':
show = task.is_actionable

if self.expand:
item.set_expanded(True)
self.expand = False
Expand Down Expand Up @@ -144,7 +144,7 @@ def __init__(self, ds, pane):

def set_query(self, query: str) -> None:
self.query = query

try:
self.checks = search.parse_search_query(query)
except search.InvalidQuery:
Expand All @@ -153,7 +153,7 @@ def set_query(self, query: str) -> None:

def match_tags(self, task: Task) -> bool:
"""Match selected tags to task tags."""

return len(self.tags.intersection(set(task.tags))) >= len(self.tags)


Expand All @@ -179,4 +179,4 @@ def do_match(self, item) -> bool:

return search.search_filter(task, self.checks)
else:
return False
return False
2 changes: 1 addition & 1 deletion GTG/core/firstrun_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,5 @@ def generate() -> etree.Element:
tag_tag = etree.SubElement(taglist, 'tag')
tag_tag.set('id', tid)
tag_tag.set('name', tag)

return etree.ElementTree(root)
4 changes: 2 additions & 2 deletions GTG/core/plugins/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self,
self.app = app
self.ds = app.ds
self.browser = app.browser

self.selection_changed_callback_listeners = []

if taskeditor:
Expand All @@ -60,7 +60,7 @@ def __init__(self,
else:
self.__ui = self.browser
self.__task_id = None

for pane in self.browser.panes.values():
pane.task_selection.connect('selection-changed', self.__selection_changed, pane)

Expand Down
2 changes: 1 addition & 1 deletion GTG/core/saved_searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def new(self, name: str, query: str, parent: UUID = None) -> SavedSearch:
self.model.append(search)

return search


def add(self, item, parent_id: UUID = None) -> None:
"""Add a tag to the tagstore."""
Expand Down
19 changes: 9 additions & 10 deletions GTG/core/sorters.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

def unwrap(row, expected_type):
"""Find an item in TreeRow widget (sometimes nested)."""

item = row

while type(item) is not expected_type:
item = item.get_item()

Expand All @@ -40,7 +40,7 @@ def __init__(self):


def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand All @@ -63,7 +63,7 @@ def __init__(self):


def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand All @@ -86,7 +86,7 @@ def __init__(self):


def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand All @@ -109,7 +109,7 @@ def __init__(self):


def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand All @@ -133,14 +133,14 @@ def __init__(self):

def get_first_letter(self, tags) -> str:
"""Get first letter of the first tag in a set of tags."""

# Fastest way to get the first item
# on a set in Python
for t in tags:
return t.name[0]

def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand Down Expand Up @@ -170,7 +170,7 @@ def __init__(self):


def do_compare(self, a, b) -> Gtk.Ordering:

a = unwrap(a, Task)
b = unwrap(b, Task)

Expand All @@ -183,4 +183,3 @@ def do_compare(self, a, b) -> Gtk.Ordering:
return Gtk.Ordering.SMALLER
else:
return Gtk.Ordering.EQUAL

10 changes: 5 additions & 5 deletions GTG/core/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def has_icon(self) -> bool:

return self._icon


@GObject.Property(type=int, default=0)
def task_count_open(self) -> int:

Expand Down Expand Up @@ -181,8 +181,8 @@ def get_ancestors(self) -> List['Tag']:

def __hash__(self):
return id(self)


class TagStore(BaseStore):
"""A tree of tags."""

Expand Down Expand Up @@ -226,7 +226,7 @@ def __str__(self) -> str:
def get_all_tag_names(self) -> List[str]:
"""Return all tag names."""
return list(self.lookup_names.keys())


def find(self, name: str) -> Tag:
"""Get a tag by name."""
Expand Down Expand Up @@ -347,7 +347,7 @@ def rand_color() -> str:
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)

return f'#{r:02x}{g:02x}{b:02x}'

color = rand_color()
Expand Down
Loading

0 comments on commit e56f8fd

Please sign in to comment.