Пример #1
0
    def get_list_by_country_state(self, country_code, state_code):
        country_list = self.reference_info['countries']
        state_list = get_dict(country_list, 'countryCode',
                              country_code).get('states', [])

        return get_dict(state_list, 'stateFipsCode',
                        state_code).get(self.ref_list_key, [])
Пример #2
0
 def get_allowed_transitions(self, existing_field_value):
     '''
     :return list of allowed new values. Return an empty list if the existing_field_value isn't in the reference list.
     :param string existing_field_value:
     '''
     return get_dict(self.reference_info, 'existingField',
                     existing_field_value).get('newFields', [])
Пример #3
0
    def get_state_codes(self, country_code):
        country_list = self.reference_info['countries']
        state_list = get_dict(country_list, 'countryCode',
                              country_code).get('states', [])
        state_code_list = [d['stateFipsCode'] for d in state_list]

        return state_code_list
Пример #4
0
 def get_land_net_templates(self, district_code):
     land_net_templates = self.reference_info['landNetTemplates']
     try:
         land_net_template = get_dict(land_net_templates, 'districtCode',
                                      district_code.strip()).get(
                                          'landNetTemplate', {})
     except StopIteration:
         land_net_template = {}
     return land_net_template
Пример #5
0
 def get_national_water_use_codes(self, site_type_code):
     site_type_list = self.reference_info['siteTypeCodes']
     return get_dict(site_type_list, 'siteTypeCode',
                     site_type_code).get('nationalWaterUseCodes', [])