diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-04-05 10:12:17 +0200 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-04-05 10:12:17 +0200 |
| commit | 6dcdffeea79c76436fccaad5b382af709af8c121 (patch) | |
| tree | ff3191f8fa6bdecd8f32c959d626c38aa63a5567 /src/match_up/__init__.py | |
| parent | bd3bd7de2fdb6cdb181a9b02b627c98c712f3739 (diff) | |
Updated the code the be in the right place for the data model
Diffstat (limited to 'src/match_up/__init__.py')
| -rw-r--r-- | src/match_up/__init__.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/match_up/__init__.py b/src/match_up/__init__.py index c9c3d0b..2b1e42b 100644 --- a/src/match_up/__init__.py +++ b/src/match_up/__init__.py @@ -1,25 +1,25 @@ from pathlib import PurePath -from time import sleep -from match_up.model import PlayerDatabase -from match_up.tests import generate_test_database, remove_test_database +from match_up.model import PlaySession +from match_up.tests import ( + TEST_DATABASE_LOCATION, + generate_test_database, + activate_random_players, +) +DATABASE_LOCATION = "storage.json" -class PlaySession: - def __init__(self, database_location: PurePath): - self.data = PlayerDatabase(database_location) - def end(self): - self.data.close() - - def __del__(self): - self.end() +class Application: + def __init__(self, debug=False): + if debug: + database_location = TEST_DATABASE_LOCATION + else: + database_location = DATABASE_LOCATION + self.session = PlaySession(PurePath(database_location)) def main(): generate_test_database() - s = PlaySession(PurePath("test_storage.json")) - for player in s.data.get_players(): - print(player) - sleep(2) - s.end() - remove_test_database() + activate_random_players() + a = Application(debug=True) + print(a.session) |
