From 5e0917e71af43712ad9a36297f4d380faaa0a951 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Mon, 23 Sep 2024 12:06:52 -0700 Subject: [PATCH] style: Fixes style --- .pylintrc | 4 ++-- .vscode/settings.json | 9 ++++++++- e4e_data_management/cli.py | 12 +++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.pylintrc b/.pylintrc index e2f9d76..6f59fbb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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] diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b38853..d362e12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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 } \ No newline at end of file diff --git a/e4e_data_management/cli.py b/e4e_data_management/cli.py index 66d2b63..2336725 100644 --- a/e4e_data_management/cli.py +++ b/e4e_data_management/cli.py @@ -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): @@ -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}')