Derives a mapper from the given item. This item should not
 be a collection.

 @param item [Object]
 @return [Class] A mapper, typically a subclass of Yaks::Mapper

 @raise [RuntimeError] only occurs when no mapper is found for the given item.
160601
def derive_mapper_from_item(item)
      klass = item.class
      namespaces = klass.name.split("::")[0...-1]
      begin
        return build_mapper_class(namespaces, klass)
      rescue NameError
        klass = next_class_for_lookup(item, namespaces, klass)
        retry if klass
      end
      raise_mapper_not_found(item)
    end
1086290
def mapper(self, meta_data, instance):
        
        d = dict(meta_data)
        v = d.pop(self.aggregation_meta_data)
        instance = deepcopy(instance)
        instance.value[self.aggregation_meta_data] = v
        return instance
1234380
def to_simple_navigation_item(item_container)
      SimpleNavigation::Item.new(item_container, key, name, url, options)
    end
67842
def get(self, CachableItem):
        
        return self.session.\
                        query(self.mapper.factory().__class__).\
                        filter(self.mapper.factory().__class__.__dict__[self.mapper.key()]==CachableItem.getId()).\
                        first()
905943
def MapItemsIterator(function, items):
  """"""
  return ItemsIterator(
      items=map(function, items), total_count=items.total_count)
958354
def transform(self, callback):
        
        self._items = self.map(callback).all()

        return self
384832
def get_as_map(self, key):
        
        if key == None:
            map = {}
            for (k, v) in self.items():
                map[k] = v
            return map
        else:
            value = self.get(key)
            return MapConverter.to_map(value)
637066
def get(self, item):
        
        if item in self:  # noqa
            item = getattr(self, item)
            return item()
193813
def <<(item)
    if item.kind_of? Condition
      add_condition(item)
    elsif item.kind_of? Action
      add_action(item)
    else
      raise "Invalid item: #{item.class}"
    end
    self
  end
920299
public function setItem($key, $item) {
		if (is_array($key)) {
			$key = $this->arrayHashFunction($key);
		}
		
		if (! isset($this->_data[$key])) {
			$this->_map[] = $key;
		}
		
		if (is_object($item)) {
			$modelClass = $this->getModel();
			if (! $item instanceof $modelClass) {
				throw new Exception('Model must be an instance of "' . $modelClass . '"');
			}
			
			$item->setCollection($this);
			
			$this->_data[$key]   = &$item->getDataLinked();
			$this->_models[$key] = $item;
		}
		elseif (is_array($item)) {
			$this->_data[$key] = $item;
		}
		else {
			throw new Exception('Unknown type of item: "' . gettype($item) . '"');
		}
		
		return $this;
	}
166577
def make_tohu_items_class(clsname, attr_names):
    

    item_cls = attr.make_class(clsname, {name: attr.ib() for name in attr_names}, repr=False, cmp=True, frozen=True)

    def new_repr(self):
        all_fields = ', '.join([f'{name}={repr(value)}' for name, value in attr.asdict(self).items()])
        return f'{clsname}({all_fields})'

    orig_eq = item_cls.__eq__

    def new_eq(self, other):
        """
        Custom __eq__() method which also allows comparisons with
        tuples and dictionaries. This is mostly for convenience
        during testing.
        """

        if isinstance(other, self.__class__):
            return orig_eq(self, other)
        else:
            if isinstance(other, tuple):
                return attr.astuple(self) == other
            elif isinstance(other, dict):
                return attr.asdict(self) == other
            else:
                return NotImplemented

    item_cls.__repr__ = new_repr
    item_cls.__eq__ = new_eq
    item_cls.keys = lambda self: attr_names
    item_cls.__getitem__ = lambda self, key: getattr(self, key)
    item_cls.as_dict = lambda self: attr.asdict(self)
    item_cls.to_series = lambda self: pd.Series(attr.asdict(self))

    return item_cls
29183
def from_hash(hash:, klass:, use_alias: false)
      validate_class_kit(klass)

      return hash.map { |i| from_hash(hash: i, klass: klass, use_alias: use_alias) } if hash.is_a?(Array)

      @hash_helper.indifferent!(hash)
      entity = klass.new
      attributes = @attribute_helper.get_attributes(klass)
      attributes.each do |attribute|
        key = use_alias ? (attribute[:alias] || attribute[:name]) : attribute[:name]
        type = attribute[:type]

        # if the hash value is nil skip it
        next if hash[key].nil?

        value = if is_class_kit?(type)
                  from_hash(hash: hash[key], klass: type, use_alias: use_alias)
                elsif type == Array
                  hash[key].map do |array_element|
                    if attribute[:collection_type].nil?
                      array_element
                    else
                      if is_class_kit?(attribute[:collection_type])
                        from_hash(hash: array_element, klass: attribute[:collection_type], use_alias: use_alias)
                      else
                        @value_helper.parse(type: attribute[:collection_type], value: array_element)
                      end
                    end
                  end
                else
                  hash[key]
                end

        entity.public_send(:"#{attribute[:name]}=", value)
      end

      entity
    end
337519
def <<(item)
    if(item.kind_of? Zyps::GameObject)
      self.add_object(item)
    elsif(item.kind_of? Zyps::EnvironmentalFactor)
      self.add_environmental_factor(item)
    else
      raise "Invalid item: #{item.class}" 
    end
    self
  end
557730
def _gotitem(self, key, ndim, subset=None):
        

        # create a new object to prevent aliasing
        if subset is None:
            subset = self.obj
        self = self._shallow_copy(subset)
        self._reset_cache()
        if subset.ndim == 2:
            if is_scalar(key) and key in subset or is_list_like(key):
                self._selection = key
        return self
136862
def prepare_for_cart_item(item)
      is_a_hash = item.is_a? Hash
      if is_a_hash
        prepared_item = MongoidCart::CartItem.new item

      elsif item.singleton_class.included_modules.include?(MongoidCart::ActsAsProduct)
        prepared_item = item

      else
        raise StandardError, "Given object must be a Hash or include MongoidCart::ActsAsProduct: #{item.class}"
      end


      return prepared_item
    end
285856
def update(self, key, item):
        
        return lib.zhash_update(self._as_parameter_, key, item)
1152723
def get(self, item, cache=None):
        
        if item not in self._keys:
            raise KeyError(item)
        if self._use_cache(cache) and (self._fetched or
                item in self._attrs):
            return self._attrs[item]
        info = self.fetch(cache=cache)
        return info[item]