From 2c07d8f1f34ff3af23f820328d9c33bb38debc09 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 6 Apr 2021 13:47:26 -0400 Subject: [PATCH] fix lgtm alerts --- archivebox/config.py | 5 ++--- archivebox/logging_util.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 9bc1ab10..67987847 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -502,7 +502,7 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict: key.upper(): CONFIG.get(key.upper()) for key in config.keys() } - except: + except BaseException: # something went horribly wrong, rever to the previous version with open(f'{config_path}.bak', 'r', encoding='utf-8') as old: atomic_write(config_path, old.read()) @@ -547,7 +547,7 @@ def load_config(defaults: ConfigDefaultDict, stderr(' For config documentation and examples see:') stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration') stderr() - raise + # raise raise SystemExit(2) return extended_config @@ -1067,7 +1067,6 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG, assert isinstance(output_dir, Path) and isinstance(config['PACKAGE_DIR'], Path) try: - import django from django.core.management import call_command sys.path.append(str(config['PACKAGE_DIR'])) diff --git a/archivebox/logging_util.py b/archivebox/logging_util.py index 492ae55e..d0972191 100644 --- a/archivebox/logging_util.py +++ b/archivebox/logging_util.py @@ -157,7 +157,7 @@ class TimedProgress: # kill the progress bar subprocess try: self.p.close() # must be closed *before* its terminnated - except: + except BaseException: pass self.p.terminate() self.p.join() @@ -223,7 +223,6 @@ def progress_bar(seconds: int, prefix: str='') -> None: # sys.stdout.flush() except (KeyboardInterrupt, BrokenPipeError): print() - pass def log_cli_command(subcommand: str, subcommand_args: List[str], stdin: Optional[str], pwd: str):