def select_from_object(cls, obj, replay): return db.session.query(cls).filter( and_( cls.__INFO__==INFO.select_from_object(replay).__id__, cls.id==obj.id ) ).one_or_none()
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) player = None if not obj.player else PLAYER.select_from_object(obj.player, replay) return { 'info' : info, 'player' : player, }
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) unit_controller = None if not obj.unit_controller else PLAYER.select_from_object( obj.unit_controller, replay) unit = None if not obj.unit else OBJECT.select_from_object( obj.unit, replay) return {'info': info, 'unit_controller': unit_controller, 'unit': unit}
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) player = None if not obj.player else PLAYER.select_from_object( obj.player, replay) ability = None if not obj.ability else ABILITY.select_from_object( obj.ability, replay) return {'info': info, 'player': player, 'ability': ability}
def select_from_object(cls, obj, replay): NULLPLAYER = namedtuple('NULLPLAYER', ('detail_data', )) obj = obj if obj else NULLPLAYER({'bnet': {'uid': -1}}) return db.session.query(cls).filter( and_(cls.id == obj.detail_data['bnet']['uid'], cls.__INFO__ == INFO.select_from_object(replay).__id__)).one_or_none() pass
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) unit = None if not obj.unit else OBJECT.select_from_object(obj.unit, replay) unit_type = None if not obj.unit_type_name else UNIT_TYPE.select_from_str_id(obj.unit_type_name, replay) return { 'info' : info, 'unit' : unit, 'unit_type' : unit_type }
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) return { 'info' : info, }
def process_dependancies(cls, replay): UT = None if not replay else INFO.select_from_object(replay) return {'replay': UT, '__INFO__': None if UT else UT.__id__}
def process(cls, replay): MAP.process(replay) INFO.process(replay) PLAYER.process(replay) OBJECT.process(replay)
def process_dependancies(cls, _unit, replay): info = None if not replay else INFO.select_from_object(replay) unit = None if not _unit else OBJECT.select_from_object(_unit, replay) return {'info': info, 'unit': unit}
action = args.action if action == 'db': home = '/Users/jacob/Library/Application Support/Blizzard/StarCraft II/Accounts/91611726/1-S2-1-4635037/Replays/Multiplayer/' sc2Replays = listdir(home) for r in sc2Replays: if r != '.DS_Store': try: replay = sc2reader.load_replay(home + r, load_level=1) print(r) except Exception as e: print(e) continue if INFO.process_conditions(replay): print(r) try: replay = sc2reader.load_replay(home + r, load_level=5, load_map=True) inject = INJECT(replay).__construct__() except Exception as e: print(e) elif action == 'app': from src.app.index import * elif action == 'explore': events = {} replay = sc2reader.load_replay('example.SC2Replay',