(self, domain)
return hierarchy
Returns a graph of the form
        {
           '<loc_type_id>: (
               loc_type,
               {'<child_loc_type_id>': (child_loc_type, [...])}
           )
        }
Returns a graph of the form
        {
           '<loc_type_id>: (
               loc_type,
               {'<child_loc_type_id>': (child_loc_type, [...])}
           )
        }
Returns a graph of the form { <loc_type_id > : ( loc_type { <child_loc_type_id > : ( child_loc_type [ ... ] ) } ) }
def full_hierarchy(self, domain):
        """
        Returns a graph of the form
        {
           '<loc_type_id>: (
               loc_type,
               {'<child_loc_type_id>': (child_loc_type, [...])}
           )
        }
        """
        hierarchy = {}

        def insert_loc_type(loc_type):
            """
            Get parent location's hierarchy, insert loc_type into it, and return
            hierarchy below loc_type
            """
            if not loc_type.parent_type:
                lt_hierarchy = hierarchy
            else:
                lt_hierarchy = insert_loc_type(loc_type.parent_type)
            if loc_type.id not in lt_hierarchy:
                lt_hierarchy[loc_type.id] = (loc_type, {})
            return lt_hierarchy[loc_type.id][1]

        for loc_type in self.filter(domain=domain).all():
            insert_loc_type(loc_type)

        return hierarchy
def full_hierarchy ( self , domain ) : hierarchy = { } def insert_loc_type ( loc_type ) : """
            Get parent location's hierarchy, insert loc_type into it, and return
            hierarchy below loc_type
            """ if not loc_type . parent_type : lt_hierarchy = hierarchy else : lt_hierarchy = insert_loc_type ( loc_type . parent_type ) if loc_type . id not in lt_hierarchy : lt_hierarchy [ loc_type . id ] = ( loc_type , { } ) return lt_hierarchy [ loc_type . id ] [ 1 ] for loc_type in self . filter ( domain = domain ) . all ( ) : insert_loc_type ( loc_type ) return hierarchy