mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Explicitly declare static methods
This commit is contained in:
parent
92aa6601ab
commit
194a379c49
1 changed files with 4 additions and 0 deletions
|
@ -115,24 +115,28 @@ class Folder(Journal):
|
||||||
entry.modified = not any(entry == old_entry for old_entry in self.entries)
|
entry.modified = not any(entry == old_entry for old_entry in self.entries)
|
||||||
self.entries = mod_entries
|
self.entries = mod_entries
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _get_files(journal_path: str) -> list[str]:
|
def _get_files(journal_path: str) -> list[str]:
|
||||||
"""Searches through sub directories starting with journal_path and find all text files that look like entries"""
|
"""Searches through sub directories starting with journal_path and find all text files that look like entries"""
|
||||||
for year_folder in Folder._get_year_folders(pathlib.Path(journal_path)):
|
for year_folder in Folder._get_year_folders(pathlib.Path(journal_path)):
|
||||||
for month_folder in Folder._get_month_folders(year_folder):
|
for month_folder in Folder._get_month_folders(year_folder):
|
||||||
yield from Folder._get_day_files(month_folder)
|
yield from Folder._get_day_files(month_folder)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _get_year_folders(path: pathlib.Path) -> list[pathlib.Path]:
|
def _get_year_folders(path: pathlib.Path) -> list[pathlib.Path]:
|
||||||
for child in path.iterdir():
|
for child in path.iterdir():
|
||||||
if child.name.isdigit() and len(child.name) == 4 and child.is_dir():
|
if child.name.isdigit() and len(child.name) == 4 and child.is_dir():
|
||||||
yield child
|
yield child
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _get_month_folders(path: pathlib.Path) -> list[pathlib.Path]:
|
def _get_month_folders(path: pathlib.Path) -> list[pathlib.Path]:
|
||||||
for child in path.iterdir():
|
for child in path.iterdir():
|
||||||
if child.name in Folder.MONTH_FOLDERS and path.is_dir():
|
if child.name in Folder.MONTH_FOLDERS and path.is_dir():
|
||||||
yield child
|
yield child
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _get_day_files(path: pathlib.Path) -> list[str]:
|
def _get_day_files(path: pathlib.Path) -> list[str]:
|
||||||
for child in path.iterdir():
|
for child in path.iterdir():
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Add table
Reference in a new issue