Calling Season API.

        Arg:
           season_key: key of the season
           card_type: optional, default to micro_card. Accepted values are 
           micro_card & summary_card 
        Return:
           json data
499639
def get_season(self, season_key, card_type="micro_card"):
        

        season_url = self.api_path + "season/" + season_key + "/"
        params = {}
        params["card_type"] = card_type
        response = self.get_response(season_url, params)
        return response
866892
private Month readOptionalMonth(JSONObject json, String key) {

        try {
            String str = json.getString(key);
            return Month.valueOf(str);
        } catch (JSONException | IllegalArgumentException e) {
            LOG.debug("Reading optional JSON month failed. Default to provided default value.", e);
        }
        return null;
    }
1167067
def export_as_json(self):
        
        result = {
            "subscription": self.subscription,
        }

        if self.name:
            result["name"] = self.name

        if self.ask is not None:
            result["ask"] = self.ask

        if self.approved:
            result["approved"] = self.approved

        if self.groups:
            result["groups"] = sorted(self.groups)

        return result
702281
def as_json_api(*)
      attributes.slice(self.class.primary_key, :type).tap do |h|
        relationships_for_serialization.tap do |r|
          h[:relationships] = self.class.key_formatter.format_keys(r) unless r.empty?
        end
        h[:attributes] = self.class.key_formatter.format_keys(attributes_for_serialization)
      end
    end
562528
def ToJson(self):
        

        json = super(StateTransaction, self).ToJson()
        descriptors = [d.ToJson() for d in self.Descriptors]

        json['descriptors'] = descriptors

        return json
762211
def _magic_json(self, action='', user_id='', app_name='', patient_id='',
                    token='', parameter1='', parameter2='',
                    parameter3='', parameter4='', parameter5='',
                    parameter6='', data=''):
        
        if not token:
            token = self._token.token
        if not app_name:
            app_name = self._app_name
        if not user_id:
            if self._ehr_username:
                user_id = self._ehr_username

        return {
            'Action': action,
            'AppUserID': user_id,
            'Appname': app_name,
            'PatientID': patient_id,
            'Token': token,
            'Parameter1': parameter1,
            'Parameter2': parameter2,
            'Parameter3': parameter3,
            'Parameter4': parameter4,
            'Parameter5': parameter5,
            'Parameter6': parameter6,
            'Data': data
        }
971679
def get_json(self, key, default=None):
        
        value = self.get_str(key)
        if value is not None:
            value = from_json(value)
            if value is not None:
                return value

        if isinstance(default, (dict, list)):
            return default

        return from_json(default)
939079
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if value and self.is_multi_valued():
            return map(api.get_url_info, value)
        elif value and not self.is_multi_valued():
            return api.get_url_info(value)
        return value or default
400976
def json(self, args=None):
        
        names = ['identifier', 'abstract', 'keywords']
        out = {key: getattr(self, key) for key in names}
        out.update(self.cf_attrs)
        out = self.format(out, args)

        out['notes'] = self.notes

        out['parameters'] = str({key: {'default': p.default if p.default != p.empty else None, 'desc': ''}
                                 for (key, p) in self._sig.parameters.items()})

        if six.PY2:
            out = walk_map(out, lambda x: x.decode('utf8') if isinstance(x, six.string_types) else x)

        return out
1049808
def get_recent_seasons(self):
        

        recent_seasons_url = self.api_path + "recent_seasons/"
        response = self.get_response(recent_seasons_url)
        return response
116929
def get_season_player_stats(self, season_key, player_key):
        

        season_player_stats_url = self.api_path + "season/" + season_key + "/player/" + player_key + "/stats/"
        response = self.get_response(season_player_stats_url)
        return response
573908
def _season_from_months(months):
    
    # TODO: Move "season" accessor upstream into pandas
    seasons = np.array(['DJF', 'MAM', 'JJA', 'SON'])
    months = np.asarray(months)
    return seasons[(months // 3) % 4]
298316
def key_value(minion_id,
              pillar,  # pylint: disable=W0613
              pillar_key='redis_pillar'):
    '''
    
    '''
    # Identify key type and process as needed based on that type
    key_type = __salt__['redis.key_type'](minion_id)
    if key_type == 'string':
        return {pillar_key: __salt__['redis.get_key'](minion_id)}
    elif key_type == 'hash':
        return {pillar_key: __salt__['redis.hgetall'](minion_id)}
    elif key_type == 'list':
        list_size = __salt__['redis.llen'](minion_id)
        if not list_size:
            return {}
        return {pillar_key: __salt__['redis.lrange'](minion_id, 0,
                                                     list_size - 1)}
    elif key_type == 'set':
        return {pillar_key: __salt__['redis.smembers'](minion_id)}
    elif key_type == 'zset':
        set_size = __salt__['redis.zcard'](minion_id)
        if not set_size:
            return {}
        return {pillar_key: __salt__['redis.zrange'](minion_id, 0,
                                                     set_size - 1)}
    # Return nothing for unhandled types
    return {}
992154
def get(self, key, default=None):
        
        if key in self:
            return self.items_dict[self.__dict__[str(type(key))][key]]
        else:
            return default
1213037
def serialise(self):
        
        return {
            'marketId': self.market_id,
            'totalAvailable': None,
            'isMarketDataDelayed': None,
            'lastMatchTime': None,
            'betDelay': self.market_definition.get('betDelay'),
            'version': self.market_definition.get('version'),
            'complete': self.market_definition.get('complete'),
            'runnersVoidable': self.market_definition.get('runnersVoidable'),
            'totalMatched': self.total_matched,
            'status': self.market_definition.get('status'),
            'bspReconciled': self.market_definition.get('bspReconciled'),
            'crossMatching': self.market_definition.get('crossMatching'),
            'inplay': self.market_definition.get('inPlay'),
            'numberOfWinners': self.market_definition.get('numberOfWinners'),
            'numberOfRunners': len(self.market_definition.get('runners')),
            'numberOfActiveRunners': self.market_definition.get('numberOfActiveRunners'),
            'runners': [
                runner.serialise(
                    self.market_definition_runner_dict[(runner.selection_id, runner.handicap)]
                ) for runner in self.runners
            ],
            'publishTime': self.publish_time,
            'priceLadderDefinition': self.market_definition.get('priceLadderDefinition'),
            'keyLineDescription': self.market_definition.get('keyLineDefinition'),
            'marketDefinition': self.market_definition,  # used in lightweight
        }
959760
def _key_from_json(self, data):
        
        key = Key()
        key.algorithm = data["Algorithm"]
        key.cipher_mode = data["CipherMode"]
        key.expiration = datetime.strptime(data["Expiration"].split(".")[0],
                                           "%Y-%m-%dT%H:%M:%S")
        key.key_id = data["ID"]
        key.key = data["Key"]
        key.size = data["KeySize"]
        key.url = data["KeyUrl"]
        return key
131199
def card_account
      response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
      Promisepay::CardAccount.new(@client, response['card_accounts'])
    rescue Promisepay::UnprocessableEntity
      nil
    end