(yamlconfig)
return config
Builds a dictionary from relations configuration while maintaining compatibility
Builds a dictionary from relations configuration while maintaining compatibility
Builds a dictionary from relations configuration while maintaining compatibility
def _build_relations_config(yamlconfig):
        # type:  (List[Union[str, Dict]]) -> Dict[str, Dict[str, Any]]
        """Builds a dictionary from relations configuration while maintaining compatibility"""
        config = {}
        for element in yamlconfig:
            if isinstance(element, str):
                config[element] = {RELATION_NAME: element, SCHEMAS: [ALL_SCHEMAS]}
            elif isinstance(element, dict):
                relname = str(element.get(RELATION_NAME))  # type: str
                rel_regex = str(element.get(RELATION_REGEX))  # type: str
                schemas = element.get(SCHEMAS, [])  # type: List
                name = relname or rel_regex  # type: str
                config[name] = element.copy()
                if len(schemas) == 0:
                    config[name][SCHEMAS] = [ALL_SCHEMAS]
        return config
def _build_relations_config ( yamlconfig ) : # type:  (List[Union[str, Dict]]) -> Dict[str, Dict[str, Any]] config = { } for element in yamlconfig : if isinstance ( element , str ) : config [ element ] = { RELATION_NAME : element , SCHEMAS : [ ALL_SCHEMAS ] } elif isinstance ( element , dict ) : relname = str ( element . get ( RELATION_NAME ) ) # type: str rel_regex = str ( element . get ( RELATION_REGEX ) ) # type: str schemas = element . get ( SCHEMAS , [ ] ) # type: List name = relname or rel_regex # type: str config [ name ] = element . copy ( ) if len ( schemas ) == 0 : config [ name ] [ SCHEMAS ] = [ ALL_SCHEMAS ] return config