2022-02-16 15:18:56 +00:00
|
|
|
from worthless.classes.installer.latest import Latest
|
|
|
|
from worthless.classes.installer.diff import Diff
|
|
|
|
|
|
|
|
|
|
|
|
class Game:
|
|
|
|
def __init__(self, latest, diffs, raw):
|
|
|
|
self.latest = latest
|
|
|
|
self.diffs = diffs
|
|
|
|
self.raw = raw
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def from_dict(data):
|
2022-08-23 10:02:20 +00:00
|
|
|
try:
|
|
|
|
diffs = []
|
|
|
|
for diff in data['diffs']:
|
|
|
|
diffs.append(Diff.from_dict(diff))
|
|
|
|
return Game(Latest.from_dict(data['latest']), diffs, data)
|
2022-08-24 02:51:31 +00:00
|
|
|
except (KeyError, ValueError, TypeError):
|
2022-08-23 10:02:20 +00:00
|
|
|
return data
|