mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Refactoring / code cleanup.
Use a frozenset()-like list. See: * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well.
This commit is contained in:
parent
0306d648fa
commit
2258274c77
1 changed files with 5 additions and 5 deletions
|
@ -471,6 +471,10 @@ class GameSaveInfo(NewStruct):
|
||||||
stack_caps = attr.ib(factory=list)
|
stack_caps = attr.ib(factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
_Game_LOAD_CLASSES = [GameGlobalSaveInfo, GameGlobalStatsStruct, GameMoves,
|
||||||
|
GameSaveInfo, GameStatsStruct, ]
|
||||||
|
|
||||||
|
|
||||||
class Game(object):
|
class Game(object):
|
||||||
# for self.gstats.updated
|
# for self.gstats.updated
|
||||||
U_PLAY = _GLOBAL_U_PLAY
|
U_PLAY = _GLOBAL_U_PLAY
|
||||||
|
@ -3147,11 +3151,7 @@ class Game(object):
|
||||||
if isinstance(t, type):
|
if isinstance(t, type):
|
||||||
if not isinstance(obj, t):
|
if not isinstance(obj, t):
|
||||||
# accept old storage format in case:
|
# accept old storage format in case:
|
||||||
if (t == GameMoves
|
if t in _Game_LOAD_CLASSES:
|
||||||
or t == GameGlobalStatsStruct
|
|
||||||
or t == GameStatsStruct
|
|
||||||
or t == GameSaveInfo
|
|
||||||
or t == GameGlobalSaveInfo):
|
|
||||||
assert isinstance(obj, Struct), err_txt
|
assert isinstance(obj, Struct), err_txt
|
||||||
else:
|
else:
|
||||||
assert False, err_txt
|
assert False, err_txt
|
||||||
|
|
Loading…
Add table
Reference in a new issue