Exemplo n.º 1
0
def _get_category_name(category):
    if category[0] in SPECIAL_SEARCH_CATEGORIES:
        return category[0]
    for name, category_def in CATEGORIES.items():
        if category == category_def:
            return name
    for name, category_def in CRYSPER_CATEGORIES.items():
        if category == category_def:
            return name
    return '{0}: {1}'.format(category[0], ','.join(category))
    raise ValueError('The given category not in the CATEGORY dictionary')
Exemplo n.º 2
0
    def gb_category(self):
        if (self.level != LEVEL_0 or self.type.name == VECTOR_TYPE_NAME or
                self.type.name == OTHER_TYPE_NAME):
            return self.type.name
        type_ = self.type.name
        prefix = self.prefix
        suffix = self.suffix

        for category, values in CATEGORIES.items():
            if values == (type_, prefix, suffix):
                return category.strip()
        for category, values in CRYSPER_CATEGORIES.items():
            if values == (type_, prefix, suffix):
                return category.strip()