<s> import enum <EOL> import weakref <EOL> import functools <EOL> import cassiopeia . type . api . exception <EOL> class CassiopeiaObject ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if data . __class__ is not self . dto_type : <EOL> raise cassiopeia . type . api . exception . CassiopeiaException ( "<STR_LIT>" . format ( class_ = self . __class__ . __name__ , dto = data . __class__ . __name__ ) ) <EOL> self . data = data <EOL> def to_json ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> return self . data . to_json ( ** kwargs ) <EOL> def __str__ ( self ) : <EOL> return str ( self . data ) <EOL> def __eq__ ( self , other ) : <EOL> return self . data == other . data <EOL> def __ne__ ( self , other ) : <EOL> return self . data != other . data <EOL> def __hash__ ( self ) : <EOL> return hash ( id ( self ) ) <EOL> class LazyProperty ( object ) : <EOL> def __init__ ( self , method ) : <EOL> """<STR_LIT>""" <EOL> self . method = method <EOL> self . values = weakref . WeakKeyDictionary ( ) <EOL> def __set__ ( self , obj , value ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def __delete__ ( self , obj ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def __get__ ( self , obj , t = None ) : <EOL> try : <EOL> return self . values [ obj ] <EOL> except KeyError : <EOL> self . values [ obj ] = self . method ( obj ) <EOL> return self . values [ obj ] <EOL> def lazyproperty ( method ) : <EOL> """<STR_LIT>""" <EOL> prop = LazyProperty ( method ) <EOL> @ property <EOL> @ functools . wraps ( method ) <EOL> def lazy ( self ) : <EOL> return prop . __get__ ( self ) <EOL> return lazy <EOL> class immutablemethod ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , method ) : <EOL> """<STR_LIT>""" <EOL> self . method = method <EOL> def __set__ ( self , obj , value ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def __delete__ ( self , obj ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def __get__ ( self , obj , type = None ) : <EOL> @ functools . wraps ( self . method ) <EOL> def curried ( * args , ** kwargs ) : <EOL> return self . method ( obj , * args , ** kwargs ) <EOL> return curried <EOL> def inheritdocs ( class_ ) : <EOL> """<STR_LIT>""" <EOL> for name , method in vars ( class_ ) . items ( ) : <EOL> if not method . __doc__ : <EOL> for parent in class_ . __bases__ : <EOL> try : <EOL> p_method = getattr ( parent , name ) <EOL> if p_method and p_method . __doc__ : <EOL> method . __doc__ = p_method . __doc__ <EOL> except AttributeError : <EOL> continue <EOL> return class_ <EOL> class LookupableMixin ( object ) : <EOL> def __init__ ( self , fields , args ) : <EOL> super ( ) . __init__ ( args ) <EOL> self . fields = fields <EOL> def __getitem__ ( self , key ) : <EOL> try : <EOL> return super ( ) . __getitem__ ( key ) <EOL> except ( TypeError , IndexError , KeyError , AttributeError ) : <EOL> return self . _lookup ( key ) <EOL> class LookupableList ( LookupableMixin , list ) : <EOL> def _lookup ( self , key ) : <EOL> for field , _type in self . fields : <EOL> if isinstance ( key , _type ) : <EOL> for item in self : <EOL> attr = item <EOL> _field = field <EOL> while '<STR_LIT:.>' in _field : <EOL> _field , tail = _field . split ( '<STR_LIT:.>' , <NUM_LIT:1> ) <EOL> attr = getattr ( attr , _field ) <EOL> _field = tail <EOL> attr = getattr ( attr , _field ) <EOL> if key == attr : <EOL> return item <EOL> else : <EOL> raise KeyError ( key ) <EOL> class LookupableDict ( LookupableMixin , dict ) : <EOL> def _lookup ( self , key ) : <EOL> for field , _type in self . fields : <EOL> if isinstance ( key , _type ) : <EOL> for item in self : <EOL> attr = item <EOL> _field = field <EOL> while '<STR_LIT:.>' in _field : <EOL> _field , tail = _field . split ( '<STR_LIT:.>' , <NUM_LIT:1> ) <EOL> attr = getattr ( attr , _field ) <EOL> _field = tail <EOL> attr = getattr ( attr , _field ) <EOL> if key == attr : <EOL> return self [ item ] <EOL> else : <EOL> raise KeyError ( key ) <EOL> def indexable ( fields ) : <EOL> """<STR_LIT>""" <EOL> @ cassiopeia . type . core . common . inheritdocs <EOL> def _wrapper ( func ) : <EOL> def wrapper ( * args , ** kwargs ) : <EOL> result = func ( * args , ** kwargs ) <EOL> if isinstance ( result , list ) : <EOL> result = LookupableList ( fields , result ) <EOL> if isinstance ( result , dict ) : <EOL> result = LookupableDict ( fields , result ) <EOL> return result <EOL> return wrapper <EOL> return _wrapper <EOL> class LoadPolicy ( enum . Enum ) : <EOL> lazy = "<STR_LIT>" <EOL> eager = "<STR_LIT>" <EOL> class MasteryType ( enum . Enum ) : <EOL> ferocity = "<STR_LIT>" <EOL> resolve = "<STR_LIT>" <EOL> cunning = "<STR_LIT>" <EOL> class Lane ( enum . Enum ) : <EOL> top_lane = "<STR_LIT>" <EOL> jungle = "<STR_LIT>" <EOL> mid_lane = "<STR_LIT>" <EOL> bot_lane = "<STR_LIT>" <EOL> def for_id ( id_ ) : <EOL> try : <EOL> return Lane . by_id [ id_ ] <EOL> except : <EOL> return None <EOL> Lane . by_id = { <EOL> <NUM_LIT:1> : Lane . top_lane , <EOL> <NUM_LIT:2> : Lane . mid_lane , <EOL> <NUM_LIT:3> : Lane . jungle , <EOL> <NUM_LIT:4> : Lane . bot_lane <EOL> } <EOL> class Role ( enum . Enum ) : <EOL> none = "<STR_LIT>" <EOL> solo = "<STR_LIT>" <EOL> duo = "<STR_LIT>" <EOL> carry = "<STR_LIT>" <EOL> support = "<STR_LIT>" <EOL> def for_id ( id_ ) : <EOL> try : <EOL> return Role . by_id [ id_ ] <EOL> except : <EOL> return None <EOL> Role . by_id = { <EOL> <NUM_LIT:1> : Role . duo , <EOL> <NUM_LIT:2> : Role . support , <EOL> <NUM_LIT:3> : Role . carry , <EOL> <NUM_LIT:4> : Role . solo <EOL> } <EOL> class Side ( enum . Enum ) : <EOL> blue = <NUM_LIT:100> <EOL> red = <NUM_LIT:200> <EOL> class Queue ( enum . Enum ) : <EOL> custom = "<STR_LIT>" <EOL> normal_blind_fives = "<STR_LIT>" <EOL> bot_fives = "<STR_LIT>" <EOL> bot_intro_fives = "<STR_LIT>" <EOL> bot_beginner_fives = "<STR_LIT>" <EOL> bot_intermediate_fives = "<STR_LIT>" <EOL> normal_blind_threes = "<STR_LIT>" <EOL> normal_draft_fives = "<STR_LIT>" <EOL> dominion_blind = "<STR_LIT>" <EOL> dominion_draft = "<STR_LIT>" <EOL> bot_dominion = "<STR_LIT>" <EOL> ranked_solo = "<STR_LIT>" <EOL> ranked_premade_threes = "<STR_LIT>" <EOL> ranked_premade_fives = "<STR_LIT>" <EOL> ranked_threes = "<STR_LIT>" <EOL> ranked_fives = "<STR_LIT>" <EOL> bot_threes = "<STR_LIT>" <EOL> team_builder = "<STR_LIT>" <EOL> aram = "<STR_LIT>" <EOL> one_for_all = "<STR_LIT>" <EOL> showdown_solo = "<STR_LIT>" <EOL> showdown_duo = "<STR_LIT>" <EOL> hexakill_summoners_rift = "<STR_LIT>" <EOL> urf = "<STR_LIT>" <EOL> bot_urf = "<STR_LIT>" <EOL> doom_bots_1 = "<STR_LIT>" <EOL> doom_bots_2 = "<STR_LIT>" <EOL> doom_bots_5 = "<STR_LIT>" <EOL> ascension = "<STR_LIT>" <EOL> hexakill_twisted_treeline = "<STR_LIT>" <EOL> butchers_bridge = "<STR_LIT>" <EOL> poro_king = "<STR_LIT>" <EOL> nemesis_draft = "<STR_LIT>" <EOL> black_market = "<STR_LIT>" <EOL> dynamic_queue = "<STR_LIT>" <EOL> ranked_dynamic_queue = "<STR_LIT>" <EOL> def for_id ( id_ ) : <EOL> try : <EOL> return Queue . by_id [ id_ ] <EOL> except : <EOL> return None <EOL> Queue . by_id = { <EOL> <NUM_LIT:0> : Queue . custom , <EOL> <NUM_LIT> : Queue . aram , <EOL> <NUM_LIT:2> : Queue . normal_blind_fives , <EOL> <NUM_LIT:4> : Queue . ranked_solo , <EOL> <NUM_LIT:6> : Queue . ranked_premade_fives , <EOL> <NUM_LIT:7> : Queue . bot_fives , <EOL> <NUM_LIT:8> : Queue . normal_blind_threes , <EOL> <NUM_LIT:9> : Queue . ranked_premade_threes , <EOL> <NUM_LIT> : Queue . hexakill_summoners_rift , <EOL> <NUM_LIT> : Queue . urf , <EOL> <NUM_LIT> : Queue . normal_draft_fives , <EOL> <NUM_LIT:16> : Queue . dominion_blind , <EOL> <NUM_LIT> : Queue . dominion_draft , <EOL> <NUM_LIT> : Queue . bot_urf , <EOL> <NUM_LIT> : Queue . bot_dominion , <EOL> <NUM_LIT> : Queue . doom_bots_1 , <EOL> <NUM_LIT> : Queue . doom_bots_2 , <EOL> <NUM_LIT> : Queue . doom_bots_5 , <EOL> <NUM_LIT> : Queue . bot_intro_fives , <EOL> <NUM_LIT:32> : Queue . bot_beginner_fives , <EOL> <NUM_LIT> : Queue . bot_intermediate_fives , <EOL> <NUM_LIT> : Queue . hexakill_twisted_treeline , <EOL> <NUM_LIT:100> : Queue . butchers_bridge , <EOL> <NUM_LIT> : Queue . one_for_all , <EOL> <NUM_LIT> : Queue . ranked_threes , <EOL> <NUM_LIT> : Queue . ranked_fives , <EOL> <NUM_LIT> : Queue . poro_king , <EOL> <NUM_LIT> : Queue . ascension , <EOL> <NUM_LIT> : Queue . showdown_solo , <EOL> <NUM_LIT> : Queue . bot_threes , <EOL> <NUM_LIT> : Queue . nemesis_draft , <EOL> <NUM_LIT> : Queue . showdown_duo , <EOL> <NUM_LIT> : Queue . black_market , <EOL> <NUM_LIT> : Queue . team_builder , <EOL> <NUM_LIT> : Queue . dynamic_queue , <EOL> <NUM_LIT> : Queue . ranked_dynamic_queue <EOL> } <EOL> ranked_queues = { Queue . ranked_solo , Queue . ranked_threes , Queue . ranked_fives , Queue . ranked_dynamic_queue } <EOL> class Tier ( enum . Enum ) : <EOL> challenger = "<STR_LIT>" <EOL> master = "<STR_LIT>" <EOL> diamond = "<STR_LIT>" <EOL> platinum = "<STR_LIT>" <EOL> gold = "<STR_LIT>" <EOL> silver = "<STR_LIT>" <EOL> bronze = "<STR_LIT>" <EOL> unranked = "<STR_LIT>" <EOL> class Division ( enum . Enum ) : <EOL> one = "<STR_LIT:I>" <EOL> two = "<STR_LIT>" <EOL> three = "<STR_LIT>" <EOL> four = "<STR_LIT>" <EOL> five = "<STR_LIT>" <EOL> class Season ( enum . Enum ) : <EOL> preseason_3 = "<STR_LIT>" <EOL> season_3 = "<STR_LIT>" <EOL> preseason_4 = "<STR_LIT>" <EOL> season_4 = "<STR_LIT>" <EOL> preseason_5 = "<STR_LIT>" <EOL> season_5 = "<STR_LIT>" <EOL> preseason_6 = "<STR_LIT>" <EOL> season_6 = "<STR_LIT>" <EOL> stats_seasons = { Season . season_3 , Season . season_4 , Season . season_5 , Season . season_6 } <EOL> class Region ( enum . Enum ) : <EOL> brazil = "<STR_LIT>" <EOL> europe_north_east = "<STR_LIT>" <EOL> europe_west = "<STR_LIT>" <EOL> japan = "<STR_LIT>" <EOL> korea = "<STR_LIT>" <EOL> latin_america_north = "<STR_LIT>" <EOL> latin_america_south = "<STR_LIT>" <EOL> north_america = "<STR_LIT>" <EOL> oceania = "<STR_LIT>" <EOL> pbe = "<STR_LIT>" <EOL> russia = "<STR_LIT>" <EOL> turkey = "<STR_LIT>" <EOL> class Platform ( enum . Enum ) : <EOL> brazil = "<STR_LIT>" <EOL> europe_north_east = "<STR_LIT>" <EOL> europe_west = "<STR_LIT>" <EOL> korea = "<STR_LIT>" <EOL> latin_america_north = "<STR_LIT>" <EOL> latin_america_south = "<STR_LIT>" <EOL> north_america = "<STR_LIT>" <EOL> oceania = "<STR_LIT>" <EOL> russia = "<STR_LIT>" <EOL> turkey = "<STR_LIT>" <EOL> class Map ( enum . Enum ) : <EOL> summoners_rift_summer = <NUM_LIT:1> <EOL> summoners_rift_autumn = <NUM_LIT:2> <EOL> the_proving_grounds = <NUM_LIT:3> <EOL> twisted_treeline_original = <NUM_LIT:4> <EOL> the_crystal_scar = <NUM_LIT:8> <EOL> twisted_treeline = <NUM_LIT:10> <EOL> summoners_rift = <NUM_LIT:11> <EOL> howling_abyss = <NUM_LIT:12> <EOL> butchers_bridge = <NUM_LIT> <EOL> class GameMode ( enum . Enum ) : <EOL> aram = "<STR_LIT>" <EOL> ascension = "<STR_LIT>" <EOL> classic = "<STR_LIT>" <EOL> showdown = "<STR_LIT>" <EOL> poro_king = "<STR_LIT>" <EOL> dominion = "<STR_LIT>" <EOL> one_for_all = "<STR_LIT>" <EOL> tutorial = "<STR_LIT>" <EOL> class GameType ( enum . Enum ) : <EOL> custom = "<STR_LIT>" <EOL> tutorial = "<STR_LIT>" <EOL> matched = "<STR_LIT>" <EOL> class SubType ( enum . Enum ) : <EOL> custom = "<STR_LIT>" <EOL> normal_fives = "<STR_LIT>" <EOL> normal_threes = "<STR_LIT>" <EOL> dominion = "<STR_LIT>" <EOL> aram = "<STR_LIT>" <EOL> bot_fives = "<STR_LIT>" <EOL> bot_threes = "<STR_LIT>" <EOL> ranked_solo = "<STR_LIT>" <EOL> ranked_threes = "<STR_LIT>" <EOL> ranked_fives = "<STR_LIT>" <EOL> one_for_all = "<STR_LIT>" <EOL> showdown_solo = "<STR_LIT>" <EOL> showdown_duo = "<STR_LIT>" <EOL> hexakill_summoners_rift = "<STR_LIT>" <EOL> team_builder = "<STR_LIT>" <EOL> urf = "<STR_LIT>" <EOL> bot_urf = "<STR_LIT>" <EOL> doom_bots = "<STR_LIT>" <EOL> ascension = "<STR_LIT>" <EOL> hexakill_twisted_treeline = "<STR_LIT>" <EOL> poro_king = "<STR_LIT>" <EOL> nemesis_draft = "<STR_LIT>" <EOL> black_market = "<STR_LIT>" <EOL> class StatSummaryType ( enum . Enum ) : <EOL> normal_fives = "<STR_LIT>" <EOL> normal_threes = "<STR_LIT>" <EOL> dominion = "<STR_LIT>" <EOL> aram = "<STR_LIT>" <EOL> bot_fives = "<STR_LIT>" <EOL> bot_threes = "<STR_LIT>" <EOL> ranked_solo = "<STR_LIT>" <EOL> ranked_threes = "<STR_LIT>" <EOL> ranked_premade_threes = "<STR_LIT>" <EOL> ranked_fives = "<STR_LIT>" <EOL> ranked_premade_fives = "<STR_LIT>" <EOL> one_for_all = "<STR_LIT>" <EOL> showdown_solo = "<STR_LIT>" <EOL> showdown_duo = "<STR_LIT>" <EOL> hexakill_summoners_rift = "<STR_LIT>" <EOL> team_builder = "<STR_LIT>" <EOL> urf = "<STR_LIT>" <EOL> bot_urf = "<STR_LIT>" <EOL> doom_bots = "<STR_LIT>" <EOL> ascension = "<STR_LIT>" <EOL> hexakill_twisted_treeline = "<STR_LIT>" <EOL> poro_king = "<STR_LIT>" <EOL> nemesis_draft = "<STR_LIT>" <EOL> black_market = "<STR_LIT>" <EOL> class Ascended ( enum . Enum ) : <EOL> player = "<STR_LIT>" <EOL> death = "<STR_LIT>" <EOL> npc = "<STR_LIT>" <EOL> class Building ( enum . Enum ) : <EOL> inhibitor = "<STR_LIT>" <EOL> turret = "<STR_LIT>" <EOL> class EventType ( enum . Enum ) : <EOL> ascension = "<STR_LIT>" <EOL> building_kill = "<STR_LIT>" <EOL> point_capture = "<STR_LIT>" <EOL> kill = "<STR_LIT>" <EOL> elite_monster_kill = "<STR_LIT>" <EOL> item_destruction = "<STR_LIT>" <EOL> item_purchase = "<STR_LIT>" <EOL> item_sale = "<STR_LIT>" <EOL> item_undo = "<STR_LIT>" <EOL> summoning = "<STR_LIT>" <EOL> skill_up = "<STR_LIT>" <EOL> ward_kill = "<STR_LIT>" <EOL> ward_placement = "<STR_LIT>" <EOL> class LaneType ( enum . Enum ) : <EOL> top_lane = "<STR_LIT>" <EOL> mid_lane = "<STR_LIT>" <EOL> bot_lane = "<STR_LIT>" <EOL> class LevelUp ( enum . Enum ) : <EOL> evolution = "<STR_LIT>" <EOL> normal = "<STR_LIT>" <EOL> class Monster ( enum . Enum ) : <EOL> baron = "<STR_LIT>" <EOL> dragon = "<STR_LIT>" <EOL> blue = "<STR_LIT>" <EOL> red = "<STR_LIT>" <EOL> spider = "<STR_LIT>" <EOL> rift_herald = "<STR_LIT>" <EOL> class Point ( enum . Enum ) : <EOL> windmill = "<STR_LIT>" <EOL> drill = "<STR_LIT>" <EOL> boneyard = "<STR_LIT>" <EOL> quarry = "<STR_LIT>" <EOL> refinery = "<STR_LIT>" <EOL> class Turret ( enum . Enum ) : <EOL> outer = "<STR_LIT>" <EOL> inner = "<STR_LIT>" <EOL> inhibitor = "<STR_LIT>" <EOL> nexus = "<STR_LIT>" <EOL> fountain = "<STR_LIT>" <EOL> undefined = "<STR_LIT>" <EOL> class Ward ( enum . Enum ) : <EOL> blue_trinket = "<STR_LIT>" <EOL> sight = "<STR_LIT>" <EOL> vision = "<STR_LIT>" <EOL> yellow_trinket = "<STR_LIT>" <EOL> upgraded_yellow_trinket = "<STR_LIT>" <EOL> mushroom = "<STR_LIT>" <EOL> undefined = "<STR_LIT>" </s>
