harvester_odt/pat_geocatalogo/converter.py
def _clean_tags(tags, tags_map=TAGS_MAP):
    """Clean tags according to the map"""

    def _clean_tag(tag):
        if tag not in tags_map:
            logger.warn('Found an unknown tag: {0!r}'.format(tag))
            return []

        tagvalue = tags_map[tag]
        if (tagvalue is None) or (tagvalue is False):
            return []

        if tagvalue is True:
            return [tag.capitalize()]

        if isinstance(tagvalue, basestring):
            return [tagvalue]

        return tagvalue

    new_tags = set()
    for tag in tags:
        new_tags.update(_clean_tag(tag))
    return sorted(new_tags)
Clean tags according to the map
Clean tags according to the map
Clean tags according to the map
def _clean_tags(tags, tags_map=TAGS_MAP):
    def _clean_tag(tag):
        if tag not in tags_map:
            logger.warn('Found an unknown tag: {0!r}'.format(tag))
            return []
        tagvalue = tags_map[tag]
        if (tagvalue is None) or (tagvalue is False):
            return []
        if tagvalue is True:
            return [tag.capitalize()]
        if isinstance(tagvalue, basestring):
            return [tagvalue]
        return tagvalue
    new_tags = set()
    for tag in tags:
        new_tags.update(_clean_tag(tag))
    return sorted(new_tags)
def _clean_tags ( tags , tags_map = TAGS_MAP ) : def _clean_tag ( tag ) : if tag not in tags_map : logger . warn ( 'Found an unknown tag: {0!r}' . format ( tag ) ) return [ ] tagvalue = tags_map [ tag ] if ( tagvalue is None ) or ( tagvalue is False ) : return [ ] if tagvalue is True : return [ tag . capitalize ( ) ] if isinstance ( tagvalue , basestring ) : return [ tagvalue ] return tagvalue new_tags = set ( ) for tag in tags : new_tags . update ( _clean_tag ( tag ) ) return sorted ( new_tags )
Clean tags according to the map
Clean tags according to the map
"""Clean tags according to the map"""
tags
tags_map