Return the category and subcategory keys to be set in the
        subordinate mode.

        :returns: (the category definition, the hazard/exposure definition)
        :rtype: (dict, dict)
170572
def get_parent_mode_constraints(self):
        
        h, e, _hc, _ec = self.selected_impact_function_constraints()
        if self.parent_step in [self.step_fc_hazlayer_from_canvas,
                                self.step_fc_hazlayer_from_browser]:
            category = layer_purpose_hazard
            subcategory = h
        elif self.parent_step in [self.step_fc_explayer_from_canvas,
                                  self.step_fc_explayer_from_browser]:
            category = layer_purpose_exposure
            subcategory = e
        elif self.parent_step:
            category = layer_purpose_aggregation
            subcategory = None
        else:
            category = None
            subcategory = None
        return category, subcategory
267752
def GetSubkeys(self):
    
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    return iter(self._subkeys.values())
1345035
def layer_hazard_classification(layer):
    
    if not layer.keywords.get('hazard'):
        # return nothing if not hazard layer
        return None

    hazard_classification = None
    # retrieve hazard classification from hazard layer
    for classification in hazard_classes_all:
        classification_name = layer.keywords['classification']
        if classification_name == classification['key']:
            hazard_classification = classification
            break
    return hazard_classification
621091
public FSArray getCategories() {
    if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null)
      jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor");
    return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categories)));}
871376
def get_keywords(self):
        
        keywords = {}
        inasafe_fields = {}
        keywords['layer_geometry'] = self.get_layer_geometry_key()
        if self.step_kw_purpose.selected_purpose():
            keywords['layer_purpose'] = self.step_kw_purpose.\
                selected_purpose()['key']
        if self.step_kw_subcategory.selected_subcategory():
            key = self.step_kw_purpose.selected_purpose()['key']
            keywords[key] = self.step_kw_subcategory.\
                selected_subcategory()['key']
        if self.get_layer_geometry_key() == layer_geometry_raster['key']:
            if self.step_kw_band_selector.selected_band():
                keywords['active_band'] = self.step_kw_band_selector.\
                    selected_band()
        if keywords['layer_purpose'] == layer_purpose_hazard['key']:
            if self.step_kw_hazard_category.selected_hazard_category():
                keywords['hazard_category'] \
                    = self.step_kw_hazard_category.\
                    selected_hazard_category()['key']
        if self.step_kw_layermode.selected_layermode():
            keywords['layer_mode'] = self.step_kw_layermode.\
                selected_layermode()['key']
        if self.step_kw_unit.selected_unit():
            if self.step_kw_purpose.selected_purpose() == layer_purpose_hazard:
                key = continuous_hazard_unit['key']
            else:
                key = exposure_unit['key']
            keywords[key] = self.step_kw_unit.selected_unit()['key']
        if self.step_kw_field.selected_fields():
            field_key = self.field_keyword_for_the_layer()
            inasafe_fields[field_key] = self.step_kw_field.selected_fields()
        if self.step_kw_classification.selected_classification():
            keywords['classification'] = self.step_kw_classification.\
                selected_classification()['key']

        if keywords['layer_purpose'] == layer_purpose_hazard['key']:
            multi_classifications = self.step_kw_multi_classifications.\
                get_current_state()
            value_maps = multi_classifications.get('value_maps')
            if value_maps is not None:
                keywords['value_maps'] = value_maps
            thresholds = multi_classifications.get('thresholds')
            if thresholds is not None:
                keywords['thresholds'] = thresholds
        else:
            if self.step_kw_layermode.selected_layermode():
                layer_mode = self.step_kw_layermode.selected_layermode()
                if layer_mode == layer_mode_continuous:
                    thresholds = self.step_kw_threshold.get_threshold()
                    if thresholds:
                        keywords['thresholds'] = thresholds
                elif layer_mode == layer_mode_classified:
                    value_map = self.step_kw_classify.selected_mapping()
                    if value_map:
                        keywords['value_map'] = value_map

        if self.step_kw_source.leSource.text():
            keywords['source'] = self.step_kw_source.leSource.text()
        if self.step_kw_source.leSource_url.text():
            keywords['url'] = self.step_kw_source.leSource_url.text()
        if self.step_kw_source.leSource_scale.text():
            keywords['scale'] = self.step_kw_source.leSource_scale.text()
        if self.step_kw_source.ckbSource_date.isChecked():
            keywords['date'] = self.step_kw_source.dtSource_date.dateTime()
        if self.step_kw_source.leSource_license.text():
            keywords['license'] = self.step_kw_source.leSource_license.text()
        if self.step_kw_title.leTitle.text():
            keywords['title'] = self.step_kw_title.leTitle.text()

        inasafe_fields.update(self.step_kw_inasafe_fields.get_inasafe_fields())
        inasafe_fields.update(
            self.step_kw_default_inasafe_fields.get_inasafe_fields())
        inasafe_fields.update(
            self.step_kw_fields_mapping.get_field_mapping()['fields'])

        if inasafe_fields:
            keywords['inasafe_fields'] = inasafe_fields

        inasafe_default_values = {}
        if keywords['layer_geometry'] == layer_geometry_raster['key']:
            pass
            # Notes(IS): Skipped assigning raster inasafe default value for
            # now.
            # inasafe_default_values = self.\
            #     step_kw_inasafe_raster_default_values.\
            #     get_inasafe_default_values()
        else:
            inasafe_default_values.update(
                self.step_kw_default_inasafe_fields.get_inasafe_default_values(
                ))
            inasafe_default_values.update(
                self.step_kw_fields_mapping.get_field_mapping()['values'])

        if inasafe_default_values:
            keywords['inasafe_default_values'] = inasafe_default_values

        if self.step_kw_subcategory.selected_subcategory():
            subcategory = self.step_kw_subcategory.selected_subcategory()
            if subcategory.get('extra_keywords'):
                extra_keywords = self.step_kw_extra_keywords.\
                    get_extra_keywords()
                if extra_keywords:
                    keywords['extra_keywords'] = extra_keywords

        return keywords
199106
def category(self) -> str:
        '''

        '''

        logger.debug('dir(self.__module__): %s', dir(self.__module__))

        return self.__module__.__name__.rsplit('.', 2)[-2].replace('test_', '')
790157
def inasafe_fields_for_the_layer(self):
        
        if (self.parent.get_layer_geometry_key()
                == layer_geometry_raster['key']):
            return []
        # Get hazard or exposure value
        layer_purpose_key = self.parent.step_kw_purpose.selected_purpose()[
            'key']
        if layer_purpose_key != layer_purpose_aggregation['key']:
            subcategory_key = self.parent.step_kw_subcategory.\
                selected_subcategory()['key']
        else:
            subcategory_key = None
        # Get all fields with replace_null = False
        inasafe_fields = get_fields(
            layer_purpose_key,
            subcategory_key,
            replace_null=False,
            in_group=False)
        # remove compulsory field since it has been set in previous step
        try:
            inasafe_fields.remove(get_compulsory_fields(
                layer_purpose_key, subcategory_key))
        except ValueError:
            pass
        return inasafe_fields
855062
def get(self):
        
        section = {}
        if self.key is not None and self.value is not None:
            section[self.key] = self.value
        return section
89647
def categories(self, value):
        

        if value is not None:
            assert type(value) is dict, "'{0}' attribute: '{1}' type is not 'dict'!".format("categories", value)
            for key, element in value.iteritems():
                assert type(key) is dict, "'{0}' attribute: '{1}' type is not 'dict'!".format("categories", key)
                assert type(element) is list, "'{0}' attribute: '{1}' type is not 'list'!".format(
                    "categories", element)
        self.__categories = value
595856
def categories(self):
        """"""
        category_dict = {}
        for ligand in self:
            if ligand.category in category_dict:
                category_dict[ligand.category].append(ligand)
            else:
                category_dict[ligand.category] = [ligand]
        return category_dict
641683
def category_count(self):
        """"""
        category_dict = self.categories
        count_dict = {category: len(
            category_dict[category]) for category in category_dict}
        return count_dict
712952
def get_keys(self):
        
        keys = []
        for section in self.get_sections():
            phase = self._sections[section]
            for obj in phase:
                keys += obj.get_id()
        keys.sort()
        return keys
901142
def write_category_indexes
      if self.layouts.key? 'category_index'
        self.categories.keys.each do |category|
          self.write_category_index(category)
        end

      # Throw an exception if the layout couldn't be found.
      else
        throw "No 'category_index' layout found."
      end
    end
915563
def obtain_category_list(sub_only = false)

      segments = params[:slug].split('/')
      category_url = Setting.get('category_slug')
      # variables and data

      # check to see if we are on the category term type, that we just want the sub cateogries and the segments actually exist
      if segments[1] == category_url && sub_only && !segments[2].blank?

        # get the current category
        parent_term = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :structured_url => "/" +  segments.drop(2).join('/')).includes(:term_anatomy).first

        terms =
          if !parent_term.blank?
            # get all the records with the current category as its parent
            Term.where(:parent_id => parent_term.id)
          else
            []
          end

      else
        # get all the categories
        terms = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :parent_id => nil).includes(:term_anatomy)
      end

      li_loop_for_terms(terms.arrange, category_url)

    end
877642
def hazards_for_layer(layer_geometry_key):
    
    result = []
    for hazard in hazard_all:
        if layer_geometry_key in hazard.get('allowed_geometries'):
            result.append(hazard)

    return sorted(result, key=lambda k: k['key'])
545461
def category_names(self):
        '''
        
        '''
        if hasattr(self, '_category_names'):
            return self._category_names
        with open(os.path.join(os.path.dirname(__file__), 'category_names.txt'), 'r') as fd:
            self._category_names = fd.read().splitlines()
        return self._category_names
1058803
def __show_categories_tree(self):
        
        for cat in self.categories_tree:
            print("%s (%i)" % (self.categories[cat], cat))
            for subcat in self.categories_tree[cat]:
                print("-> %s (%i)" % (self.categories[subcat], subcat))