Fill id2obj_user with all parent/relationship key item IDs and their objects.
491189
def fill_parentidid2obj_r1(self, id2obj_user, child_obj):
        """"""
        for higher_obj in self._getobjs_higher(child_obj):
            if higher_obj.item_id not in id2obj_user:
                id2obj_user[higher_obj.item_id] = higher_obj
                self.fill_parentidid2obj_r1(id2obj_user, higher_obj)
925456
def each_object_id(collection):
    """"""
    c_path = collection_path(collection)
    paths = glob('%s/*.%s' % (c_path, _ext))
    for path in paths:
        match = regex.match(r'.+/(.+)\.%s$' % _ext, path)
        yield match.groups()[0]
225125
def _traverse_parent_objs(self, p2cs, goobj_child, goids_seen):
        """"""
        # Update public(go2obj p2cs), private(goids_seen)
        child_id = goobj_child.id
        # mark child as seen
        goids_seen.add(child_id)
        ##A self.go2obj[child_id] = goobj_child
        # Update goids_seen and go2obj with child alt_ids
        for goid_altid in goobj_child.alt_ids:
            goids_seen.add(goid_altid)
            ##A self.go2obj[goid_altid] = goobj_child
        # Loop through parents of child object
        for parent_obj in goobj_child.parents:
            parent_id = parent_obj.id
            p2cs[parent_id].add(child_id)
            # If parent has not been seen, traverse
            if parent_id not in goids_seen:
                ##F self._traverse_parent_objs(p2cs, parent_obj, go2obj, goids_seen)
                self._traverse_parent_objs(p2cs, parent_obj, goids_seen)
674255
private static function loadItems($property_id)
	{
		self::$_items[$property_id] = [];
		$models = static::find()
			->where('property_id=:property_id', [':property_id' => $property_id])
			->orderBy('position')
			->all();
		foreach($models as $model)
			self::$_items[$property_id][$model->code] = $model->name;
	}
1305510
def add_user(self, **kwargs):
        """"""
        user = self.UserClass(**kwargs)
        if hasattr(user, 'active'):
            user.active = True
        self.db_adapter.add_object(user)
        return user
1043296
final void fillIDs(long keyPart, int intIndex, GHIntHashSet set, int depth) {
        long pointer = (long) intIndex << 2;
        if (depth == entries.length) {
            int nextIntPointer = dataAccess.getInt(pointer);
            if (nextIntPointer < 0) {
                // single data entries (less disc space)
                set.add(-(nextIntPointer + 1));
            } else {
                long max = (long) nextIntPointer * 4;
                // leaf entry => nextIntPointer is maxPointer
                for (long leafIndex = pointer + 4; leafIndex < max; leafIndex += 4) {
                    set.add(dataAccess.getInt(leafIndex));
                }
            }
            return;
        }
        int offset = (int) (bitmasks[depth] & keyPart) << 2;
        int nextIntPointer = dataAccess.getInt(pointer + offset);
        if (nextIntPointer > 0) {
            // tree entry => negative value points to subentries
            fillIDs(keyPart >>> shifts[depth], nextIntPointer, set, depth + 1);
        }
    }
1158200
public QueryBuilder addParentIds(final Integer id1, final Integer... ids) {
        parentIds.add(id1);
        parentIds.addAll(Arrays.asList(ids));
        return this;
    }
937156
def get_user_by_id(self, id):
        """"""
        return self.db_adapter.get_object(self.UserClass, id=id)
666342
def get_leaf_children(gos_user, go2obj_arg):
    """"""
    childgoid2obj = {}
    for goid_usr in gos_user:
        goobj_usr = go2obj_arg[goid_usr]
        fill_childgoid2obj(childgoid2obj, goobj_usr)
    return set(go for go, o in childgoid2obj.items() if not o.children)
803556
def get_go2parents_go2obj(go2obj):
    """"""
    goobjs, altgo2goobj = get_goobjs_altgo2goobj(go2obj)
    go2parents = get_id2parents(goobjs)
    add_alt_goids(go2parents, altgo2goobj)
    return go2parents
1037245
def mapping(self):
        

        return (
            self._user_id_mapping,
            self._user_feature_mapping,
            self._item_id_mapping,
            self._item_feature_mapping,
        )
216810
def __search_dict(self,
                      obj,
                      item,
                      parent,
                      parents_ids=frozenset({}),
                      print_as_attribute=False):
        """"""
        if print_as_attribute:
            parent_text = "%s.%s"
        else:
            parent_text = "%s[%s]"

        obj_keys = set(obj.keys())

        for item_key in obj_keys:
            if not print_as_attribute and isinstance(item_key, strings):
                item_key_str = "'%s'" % item_key
            else:
                item_key_str = item_key

            obj_child = obj[item_key]

            item_id = id(obj_child)

            if parents_ids and item_id in parents_ids:
                continue

            parents_ids_added = add_to_frozen_set(parents_ids, item_id)

            new_parent = parent_text % (parent, item_key_str)
            new_parent_cased = new_parent if self.case_sensitive else new_parent.lower()

            str_item = str(item)
            if (self.match_string and str_item == new_parent_cased) or\
               (not self.match_string and str_item in new_parent_cased):
                self.__report(
                    report_key='matched_paths',
                    key=new_parent,
                    value=obj_child)

            self.__search(
                obj_child,
                item,
                parent=new_parent,
                parents_ids=parents_ids_added)
1192774
def _recursive_upsert(context, params, data):
    """"""
    children = params.get("children", {})
    nested_calls = []
    for child_params in children:
        key = child_params.get("key")
        child_data_list = ensure_list(data.pop(key))
        if isinstance(child_data_list, dict):
            child_data_list = [child_data_list]
        if not (isinstance(child_data_list, list) and
                all(isinstance(i, dict) for i in child_data_list)):
            context.log.warn(
                "Expecting a dict or a lost of dicts as children for key", key
            )
            continue
        if child_data_list:
            table_suffix = child_params.get("table_suffix", key)
            child_params["table"] = params.get("table") + "_" + table_suffix
            # copy some properties over from parent to child
            inherit = child_params.get("inherit", {})
            for child_data in child_data_list:
                for dest, src in inherit.items():
                    child_data[dest] = data.get(src)
                nested_calls.append((child_params, child_data))
    # Insert or update data
    _upsert(context, params, data)
    for child_params, child_data in nested_calls:
        _recursive_upsert(context, child_params, child_data)
808560
protected void associateBatched(Collection owners, Collection children)
    {
        ObjectReferenceDescriptor ord = getObjectReferenceDescriptor();
        ClassDescriptor cld = getOwnerClassDescriptor();
        Object owner;
        Object relatedObject;
        Object fkValues[];
        Identity id;
        PersistenceBroker pb = getBroker();
        PersistentField field = ord.getPersistentField();
        Class topLevelClass = pb.getTopLevelClass(ord.getItemClass());
        HashMap childrenMap = new HashMap(children.size());


        for (Iterator it = children.iterator(); it.hasNext(); )
        {
            relatedObject = it.next();
            childrenMap.put(pb.serviceIdentity().buildIdentity(relatedObject), relatedObject);
        }

        for (Iterator it = owners.iterator(); it.hasNext(); )
        {
            owner = it.next();
            fkValues = ord.getForeignKeyValues(owner,cld);
            if (isNull(fkValues))
            {
                field.set(owner, null);
                continue;
            }
            id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
            relatedObject = childrenMap.get(id);
            field.set(owner, relatedObject);
        }
    }
455514
def user_default_serializer(self, obj):
        """"""
        if not obj:
            return None
        self.user_default_add_related_pks(obj)
        return dict((
            ('id', obj.id),
            ('username', obj.username),
            self.field_to_json('DateTime', 'date_joined', obj.date_joined),
            self.field_to_json(
                'PKList', 'votes', model=Choice, pks=obj._votes_pks),
        ))
663705
def add_items_to_tree_iter(self, input_dict, treeiter, parent_dict_path=None):
        
        if parent_dict_path is None:
            parent_dict_path = []
        self.get_view_selection()
        for key, value in sorted(input_dict.items()):
            element_dict_path = copy.copy(parent_dict_path) + [key]
            if isinstance(value, dict):
                new_iter = self.tree_store.append(treeiter, [key, "", True, element_dict_path])
                self.add_items_to_tree_iter(value, new_iter, element_dict_path)
            else:
                self.tree_store.append(treeiter, [key, value, False, element_dict_path])
441457
def build_id_references_tree(id_references)
      tree = {}

      id_references.each do |id_reference|
        array_of_refs = id_reference.split('/')

        t = tree
        array_of_refs.each do |ref|
          t[ref] ||= {}
          t = t[ref]
        end
      end

      tree
    end