Skip to content

Commit

Permalink
style: Fixes style
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Sep 23, 2024
1 parent c363fe3 commit 5e0917e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ min-public-methods=2
[EXCEPTIONS]

# Exceptions that will emit a warning when caught.
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception


[FORMAT]
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"editor.rulers": [
100
],
"python.testing.pytestEnabled": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
"editor.formatOnType": true
}
12 changes: 9 additions & 3 deletions e4e_data_management/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def add_files_cmd(self,
raise RuntimeError('end before start')
resolved_paths = [path
for path in resolved_paths
if start <= dt.datetime.fromtimestamp(path.stat().st_mtime, local_tz) <= end]
if start <= dt.datetime.fromtimestamp(path.stat().st_mtime, local_tz) \
<= end]
self.app.add(paths=resolved_paths, readme=readme, destination=destination)

def status_cmd(self):
Expand All @@ -223,14 +224,19 @@ def status_cmd(self):
print(self.app.status())

def ls_dir(self, path: Path):
"""Lists the files in the given directory with information relevant to e4edm
Args:
path (Path): Path to ls
"""
local_tz = dt.datetime.now().astimezone().tzinfo
print(path.as_posix())
dirs = sorted([node for node in path.glob('*') if node.is_dir()])
files = sorted([node for node in path.glob('*') if node.is_file()])
dir_times = [dt.datetime.fromtimestamp(node.stat().st_mtime, local_tz) for node in dirs]
file_times = [dt.datetime.fromtimestamp(node.stat().st_mtime, local_tz) for node in files]
for idx, dir in enumerate(dirs):
print(f'{dir_times[idx].isoformat()} {dir.name}')
for idx, dir_path in enumerate(dirs):
print(f'{dir_times[idx].isoformat()} {dir_path.name}')
for idx, file in enumerate(files):
print(f'{file_times[idx].isoformat()} {file.name}')

Expand Down

0 comments on commit 5e0917e

Please sign in to comment.