(self, case_types)
return parent_map
:param case_types: Case types to filter on. Setting to None will include all.
               todo: including all should be the default behavior since it isn't more work.
        :return: {<case_type>: {<relationship>: [<parent_type>], ...}, ...}
                 if allow_multiple_parents; otherwise
                 {<case_type>: {<relationship>: <parent_type>, ...}, ...}
                 and if there is more than one possible parent type, it arbitrarily picks one
                 and complains quietly with logger.error. Todo: this seems like bad behavior.
:param case_types: Case types to filter on. Setting to None will include all.
               todo: including all should be the default behavior since it isn't more work.
        :return: {<case_type>: {<relationship>: [<parent_type>], ...}, ...}
                 if allow_multiple_parents; otherwise
                 {<case_type>: {<relationship>: <parent_type>, ...}, ...}
                 and if there is more than one possible parent type, it arbitrarily picks one
                 and complains quietly with logger.error. Todo: this seems like bad behavior.
: param case_types : Case types to filter on . Setting to None will include all . todo : including all should be the default behavior since it isn t more work . : return : { <case_type > : { <relationship > : [ <parent_type > ] ... } ... } if allow_multiple_parents ; otherwise { <case_type > : { <relationship > : <parent_type > ... } ... } and if there is more than one possible parent type it arbitrarily picks one and complains quietly with logger . error . Todo : this seems like bad behavior .
def get_parent_type_map(self, case_types):
        """
        :param case_types: Case types to filter on. Setting to None will include all.
               todo: including all should be the default behavior since it isn't more work.
        :return: {<case_type>: {<relationship>: [<parent_type>], ...}, ...}
                 if allow_multiple_parents; otherwise
                 {<case_type>: {<relationship>: <parent_type>, ...}, ...}
                 and if there is more than one possible parent type, it arbitrarily picks one
                 and complains quietly with logger.error. Todo: this seems like bad behavior.

        """
        parent_map = defaultdict(dict)

        for case_type, case_relationships in self.get_case_relationships().items():
            rel_map = defaultdict(list)
            for parent_type, relationship in case_relationships:
                rel_map[relationship].append(parent_type)

            for relationship, types in rel_map.items():
                parent_map[case_type][relationship] = types

        if case_types is not None:
            return {case_type: rel_map for case_type, rel_map in parent_map.items()
                    if case_type in case_types}
        return parent_map
def get_parent_type_map ( self , case_types ) : parent_map = defaultdict ( dict ) for case_type , case_relationships in self . get_case_relationships ( ) . items ( ) : rel_map = defaultdict ( list ) for parent_type , relationship in case_relationships : rel_map [ relationship ] . append ( parent_type ) for relationship , types in rel_map . items ( ) : parent_map [ case_type ] [ relationship ] = types if case_types is not None : return { case_type : rel_map for case_type , rel_map in parent_map . items ( ) if case_type in case_types } return parent_map