Пример #1
0
 def __init__(self, json):
     json = json['manager']
     self.manager_id = as_int(json['manager_id'])
     self.name = json['nickname']
     self.felo_score = as_int(json.get('felo_score'))
     self.felo_tier = json.get('felo_tier')
     self.is_commissioner = as_bool(json.get('is_commissioner'))
Пример #2
0
    def __init__(self, json):
        attributes = self.__flatten_attributes(json)
        self.key = attributes.get('team_key')
        self.id = as_int(attributes.get('team_id'))
        self.name = attributes.get('name')
        self.priority = as_int(attributes.get('waiver_priority'))
        self.faab = as_int(attributes.get('faab_balance'))
        self.moves = as_int(attributes.get('number_of_moves'))
        self.trades = as_int(attributes.get('number_of_trades'))
        self.draft_grade = attributes.get('draft_grade')
        self.managers = self.__parse_managers(attributes)
        self.clinched_playoffs = as_bool(attributes.get('clinched_playoffs'))
        self.url = attributes.get('url')
        self.team_logos = self.__parse_team_logo(attributes)

        self.__parse_sub_resources(json)
Пример #3
0
 def __init__(self, json):
     json = json[0]
     self.draft_type = json.get('draft_type')
     self.is_auction = as_bool(json.get('is_auction_draft'))
     self.scoring_type = json.get('scoring_type')
     self.persistent_url = json.get('persistent_url')
     self.has_playoff = as_bool(json.get('uses_playoff'))
     self.has_consolation = as_bool(json.get('has_playoff_consolation_games'))
     self.playoff_start_week = as_int(json.get('playoff_start_week'))
     self.has_reseeding = as_bool(json.get('uses_playoff_reseeding'))
     self.lock_eliminatd_teams = as_bool(json.get('uses_lock_eliminated_teams'))
     self.num_playoff_teams = as_int(json.get('num_playoff_teams'))
     self.num_consolation_teams = as_int(json.get('num_playoff_consolation_teams'))
     self.has_multiweek_championship = json.get('has_multiweek_championship')
     self.waiver_type = json.get('waiver_type')
     self.waiver_rule = json.get('waiver_rule')
     self.uses_faab = as_bool(json.get('uses_faab'))
     self.seconds_per_pick = as_int(json.get('draft_pick_time'))
     self.post_draft_players = json.get('post_draft_players')
     self.max_teams = as_int(json.get('max_teams'))
     self.days_on_waivers = as_int(json.get('waiver_time'))
     self.trade_end_date = json.get('trade_end_date')
     self.trade_ratify_type = json.get('trade_ratify_type')
     self.days_to_veto = as_int(json.get('trade_reject_time'))
     self.player_pool = json.get('player_pool')
     self.cant_cut_list = json.get('cant_cut_list')
     self.trade_draft_picks = as_bool(json.get('can_trade_draft_picks'))
     self.fractional_points = as_bool(json.get('uses_fractional_points'))
     self.negative_points = as_bool(json.get('uses_negative_points'))
     self.divisions = self.__parse_divisions(json)
     self.roster_positions = self.__parse_roster_positions(json)
     self.stat_categories = self.__parse_stat_categories(json)
Пример #4
0
 def __init__(self, json):
     self.week = as_int(json.get('week'))
     self.week_start = json.get('week_start')
     self.week_end = json.get('week_end')
     self.status = json.get('status')
     self.is_current = self.status == 'midevent'
     self.is_playoffs = as_bool(json.get('is_playoffs'))
     self.is_consolation = as_bool(json.get('is_consolation'))
     self.is_tied = as_bool(json.get('is_tied'))
     
     self.__parse_teams(json)
Пример #5
0
    def __init__(self, json):
        attributes = flatten_attributes(json[0])
        self.key = attributes['player_key']
        self.id = as_int(attributes['player_id'])
        self.name = attributes['name']['full']
        self.first_name = attributes['name']['first']
        self.last_name = attributes['name']['last']
        self.nfl_team = attributes.get('editorial_team_abbr').upper()
        self.team_name = attributes.get('editorial_team_full_name')
        self.number = as_int(attributes.get('uniform_number'))
        self.position = attributes.get('display_position')
        self.is_undroppable = as_bool(attributes.get('is_undroppable'))
        self.status = attributes.get('status')
        self.status_full = attributes.get('status_full')
        self.injury_note = attributes.get('injury_note')
        self.bye_week = as_int(attributes.get('bye_weeks', {}).get('week'))

        self.eligible_positions = self.__parse_eligible_positions(attributes)
        self.image_url = self.__parse_image_url(attributes)

        self.__parse_sub_resources(json)
Пример #6
0
    def __parse_team_standings(self, json):
        json = json['team_standings']
        self.rank = as_int(json['rank'])
        self.playoff_seed = as_int(json.get('playoff_seed', 0))
        self.wins = as_int(json['outcome_totals']['wins'])
        self.losses = as_int(json['outcome_totals']['losses'])
        self.ties = as_int(json['outcome_totals']['ties'])
        self.percentage = as_float(json['outcome_totals']['percentage'])
        self.points_for = as_float(json['points_for'])
        self.points_against = as_float(json['points_against'])

        if 'divisional_outcome_totals' in json:
            self.div_wins = as_int(json['divisional_outcome_totals']['wins'])
            self.div_losses = as_int(
                json['divisional_outcome_totals']['losses'])
            self.div_ties = as_int(json['divisional_outcome_totals']['ties'])

        if 'streak' in json:
            self.streak_type = json['streak']['type']
            self.streak_value = as_int(json['streak']['value'])
Пример #7
0
 def __init__(self, json):
     attributes = flatten_attributes(json)
     self.key = attributes.get('league_key')
     self.id = as_int(attributes.get('league_id'))
     self.name = attributes.get('name')
     self.url = attributes.get('url')
     self.logo_url = attributes.get('logo_url')
     self.draft_status = attributes.get('draft_status')
     self.num_teams = as_int(attributes.get('num_teams'))
     self.scoring_type = attributes.get('scoring_type')
     self.league_type = attributes.get('league_type')
     self.add_injured_to_ir = as_bool(attributes.get('allow_add_to_dl_extra_pos'))
     self.current_week = as_int(attributes.get('current_week'))
     self.start_week = as_int(attributes.get('start_week'))
     self.start_date = attributes.get('start_date')
     self.end_week = as_int(attributes.get('end_week'))
     self.end_date = attributes.get('end_date')
     self.game_code = attributes.get('game_code')
     self.season = as_int(attributes.get('season'))
     self.__parse_sub_resources(json)
Пример #8
0
 def __init__(self, json):
     self.pick = as_int(json['pick'])
     self.round = as_int(json['round'])
     self.team_key = json['team_key']
     self.player = Player(json['0']['players']['0']['player'])
Пример #9
0
 def __init__(self, json):
     self.id = as_int(json['division_id'])
     self.name = json['name']
Пример #10
0
 def __parse_roster_positions(self, json):
     json = json.get('roster_positions')
     return {
         data['roster_position']['position']: as_int(data['roster_position']['count'])
         for data in json
     }
Пример #11
0
 def __parse_percent_owned(self, json):
     json = flatten_attributes(json['percent_owned'])
     self.percent_owned = as_int(json.get('value'))
     self.percent_changed = as_int(json.get('delta'))
Пример #12
0
 def __parse_stats(self, json):
     json = json['player_stats']['stats']
     self.stats = {
         as_int(s['stat']['stat_id']): as_int(s['stat']['value'])
         for s in json
     }