Refactory of the code (#19)

* Refactory of the code

* Autoformatting with black

---------

Co-authored-by: Domefemia <domefemia@hotmail.com>
This commit is contained in:
Domenico
2023-03-24 20:26:55 +01:00
committed by GitHub
parent df45ef411a
commit 053d5791a4
11 changed files with 34 additions and 53 deletions

View File

@@ -33,12 +33,10 @@ def get_games(game_ids=None):
if not os.path.exists(games_dir):
return {}
if not game_ids:
game_files = os.listdir(games_dir)
if game_ids:
game_files = [f"{game_id}.json" for game_id in game_ids]
else:
game_files = []
for game_id in game_ids:
game_files.append(game_id + ".json")
game_files = os.listdir(games_dir)
for game in game_files:
with open(os.path.join(games_dir, game), "r") as open_file: