From b0ffb01c59117397bb2e8bd907365811e3f1c84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Thu, 16 May 2024 11:18:42 +0200 Subject: [PATCH] cleanups --- lib/config.py | 2 +- lib/db_revision.py | 2 +- lib/git_exporter.py | 2 +- lib/tree_builder.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/config.py b/lib/config.py index f052d59..c8dc2c9 100644 --- a/lib/config.py +++ b/lib/config.py @@ -15,7 +15,7 @@ def config(filename="database.ini", section="production"): db[param[0]] = param[1] else: raise Exception( - "Section {0} not found in the {1} file".format(section, filename) + f"Section {section} not found in the {filename} file" ) return db diff --git a/lib/db_revision.py b/lib/db_revision.py index 0723ee8..cdc246f 100644 --- a/lib/db_revision.py +++ b/lib/db_revision.py @@ -255,7 +255,7 @@ class DBRevision: self._files.sort(key=lambda x: x["name"]) return self._files - def calc_delta(self, current_rev: Optional[DBRevision]): + def calc_delta(self, current_rev: DBRevision | None): """Calculate the list of files to download and to delete. Param current_rev is the revision that's currently checked out. If it's None, the repository is empty. diff --git a/lib/git_exporter.py b/lib/git_exporter.py index 533bf4d..76313df 100644 --- a/lib/git_exporter.py +++ b/lib/git_exporter.py @@ -40,7 +40,7 @@ class GitExporter: def check_repo_state(self, flats, branch_state): state_data = dict() if os.path.exists(self.state_file): - with open(self.state_file, "r") as f: + with open(self.state_file) as f: state_data = yaml.safe_load(f) if type(state_data) != dict: state_data = {} diff --git a/lib/tree_builder.py b/lib/tree_builder.py index 48bfe5c..65a5594 100644 --- a/lib/tree_builder.py +++ b/lib/tree_builder.py @@ -138,7 +138,7 @@ class TreeBuilder: self.requests.add(node.revision.request_id) class FindMergeWalker(AbstractWalker): - def __init__(self, builder: TreeBuilder, requests: Dict) -> None: + def __init__(self, builder: TreeBuilder, requests: dict) -> None: super().__init__() self.source_revisions = dict() self.builder = builder