From dc1d95d298677d0680e2f9733ef6c2f79b814df8 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 10 Apr 2023 06:38:48 +0200 Subject: [PATCH 1/3] refactor: remove unused file --- index.html | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index a95349f..0000000 --- a/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - Static api test - - \ No newline at end of file From ba9a868394ef4baf4fac03e22f9886d3e1f2f6b5 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 10 Apr 2023 07:55:03 +0200 Subject: [PATCH 2/3] fix: add tags to index files --- src/app/generator.py | 2 +- src/app/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/generator.py b/src/app/generator.py index dc3c540..dc58886 100644 --- a/src/app/generator.py +++ b/src/app/generator.py @@ -50,7 +50,7 @@ class ReleaseApi(Api): # At last join the current tag to an index file index_path = join(path, f'{repository_name}.json') - index = read_json(index_path) + index = read_json(index_path, []) if tag not in index: # TODO: Check if there a better way to do this index.append(tag) # Add the current tag to the index diff --git a/src/app/utils.py b/src/app/utils.py index 2cb34d8..643bdf2 100644 --- a/src/app/utils.py +++ b/src/app/utils.py @@ -8,7 +8,7 @@ def write_json(text: str | dict | list, to, overwrite=True): text = json.dumps(text) f.write(text) -def read_json(path, default=[]): +def read_json(path, default): if os.path.exists(path): with open(path, 'r') as f: return json.load(f) From cb1076eda49673190ce658af20bd036cc487760a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 10 Apr 2023 07:56:47 +0200 Subject: [PATCH 3/3] refactor: remove unnecessary use of `pass` --- src/app/generator.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/app/generator.py b/src/app/generator.py index dc58886..9d20905 100644 --- a/src/app/generator.py +++ b/src/app/generator.py @@ -10,7 +10,6 @@ class Api(): def __init__(self, name: str, api: api.Api = api.GitHubApi()) -> None: self.name = name self._api = api - pass @abstractmethod def generate(self, config, path): @@ -55,7 +54,6 @@ class ReleaseApi(Api): index.append(tag) # Add the current tag to the index write_json(index, index_path) - pass class ContributorApi(Api): def __init__(self, api) -> None: @@ -75,12 +73,10 @@ class ContributorApi(Api): contributors_path = join(path, f'{repository_name}.json') write_json(contributors, contributors_path) - pass class SocialApi(Api): def __init__(self, api) -> None: super().__init__("social", api) - pass def generate(self, config, path): new_social = config @@ -89,14 +85,12 @@ class SocialApi(Api): social = read_json(social_path, new_social) write_json(social, social_path) - pass class ApiProvider(): _apis: list[Api] def __init__(self, apis: list[Api]) -> None: self._apis = apis - pass def get(self, name: str) -> Api: for api in self._apis: @@ -114,4 +108,3 @@ class DefaultApiProvider(ApiProvider): ContributorApi(self._api), SocialApi(self._api)] ) - pass \ No newline at end of file