Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sezanzeb committed Oct 16, 2024
1 parent 46935dc commit 55718ed
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions inputremapper/gui/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ def set_autoload(self, status: bool):
def get_newest_group_key(self) -> GroupKey:
"""group_key of the group with the most recently modified preset."""
paths = []
for path in glob.glob(os.path.join(glob.escape(PathUtils.get_preset_path()), "*/*.json",)):
pattern = os.path.join(
glob.escape(PathUtils.get_preset_path()),
"*/*.json",
)
for path in glob.glob(pattern):
if self._reader_client.groups.find(key=PathUtils.split_all(path)[-2]):
paths.append((path, os.path.getmtime(path)))

Expand All @@ -249,7 +253,10 @@ def get_newest_preset_name(self) -> Name:
paths = [
(path, os.path.getmtime(path))
for path in glob.glob(
os.path.join(glob.escape(PathUtils.get_preset_path(self.active_group.name)), "*.json",)
os.path.join(
glob.escape(PathUtils.get_preset_path(self.active_group.name)),
"*.json",
)
)
]
if not paths:
Expand Down

0 comments on commit 55718ed

Please sign in to comment.