Fetches an instance or creates one using the registered factory method
        :argument key the key to look up
        :return the created or looked up instance
342242
def resolve(self, key: Any) -> Any:
        
        if key not in self._singletons:
            # if registered, determine if the result will be shared
            if key in self._factories:
                factory = self._factories[key]
                result = factory(self)
                if isinstance(factory, SingletonFactory):
                    self._singletons[key] = result
                return result
            # if not registered, try to automatically resolve it based on
            # its annotations. Automatically resolved keys are always shared
            elif isinstance(type(key), type):
                result = self._resolve_class(key)
                self._singletons[key] = result
                return result
            else:
                msg = 'Unable to resolve factory for key %s' % key
                raise ResolveException(msg)
        else:
            return self._singletons[key]
1224298
def _lookup_required_session(self, key):
        
        session = self.session_handler.do_get_session(key)
        if (not session):
            msg = ("Unable to locate required Session instance based "
                   "on session_key [" + str(key) + "].")
            raise ValueError(msg)
        return session
1182571
def get(self, key, default=Empty, creator=Empty, expire=None):
        
        try:
            return self.storage.get(key)
        except KeyError as e:
            if creator is not Empty:
                if callable(creator):
                    v = creator()
                else:
                    v = creator
                self.set(key, v, expire)
                return v
            else:
                if default is not Empty:
                    if callable(default):
                        v = default()
                        return v
                    return default
                else:
                    raise
326223
def get_by_natural_key(self, *args):
        

        kwargs = self.natural_key_kwargs(*args)

        # Since kwargs already has __ lookups in it, we could just do this:
        # return self.get(**kwargs)

        # But, we should call each related model's get_by_natural_key in case
        # it's been overridden
        for name, rel_to in self.model.get_natural_key_info():
            if not rel_to:
                continue

            # Extract natural key for related object
            nested_key = extract_nested_key(kwargs, rel_to, name)
            if nested_key:
                # Update kwargs with related object
                try:
                    kwargs[name] = rel_to.objects.get_by_natural_key(
                        *nested_key
                    )
                except rel_to.DoesNotExist:
                    # If related object doesn't exist, assume this one doesn't
                    raise self.model.DoesNotExist()
            else:
                kwargs[name] = None

        return self.get(**kwargs)
634469
def get_or_create(cls, **kwargs):
        '''
        
        '''
        session = Session()
        instance = session.query(cls).filter_by(**kwargs).first()
        session.close()

        if not instance:
            self = cls(**kwargs)
            self.save()
        else:
            self = instance

        return self
1366646
def get(self, key, default=None):
        
        if key in self.__cli:
            return self.__cli[key]
        if key in self.__config:
            return self.__config.get(key)
        if key in self.__defaults:
            return self.__defaults.get(key)
        return default
1113490
def get(self, key):
        
        try:
            return self[self.id_lookup.get(key)]

        except TypeError:
            raise KeyError
74637
def key(self, *args, **kwargs):
        
        if not args and not kwargs:
            return self.class_path
        try:
            if args and not kwargs:
                return "%s:%s" % (self.class_path, self.hash(args))
            # The line might break if your passed values are un-hashable.  If
            # it does, you need to override this method and implement your own
            # key algorithm.
            return "%s:%s:%s:%s" % (self.class_path,
                                    self.hash(args),
                                    self.hash([k for k in sorted(kwargs)]),
                                    self.hash([kwargs[k] for k in sorted(kwargs)]))
        except TypeError:
            raise RuntimeError(
                "Unable to generate cache key due to unhashable"
                "args or kwargs - you need to implement your own"
                "key generation method to avoid this problem")
587140
def get(self, key, default=None):
        
        try:
            return self[key]
        except KeyError:
            return default or self._default
1000092
def get(self, key, default=None):
        
        key = self.make_key(key)

        if self.debug:
            return default

        try:
            value = self.database[key]
        except KeyError:
            self.metrics['misses'] += 1
            return default
        else:
            self.metrics['hits'] += 1
            return pickle.loads(value)
735525
def get_or_create(self, **kwargs):
        
        assert kwargs, "get_or_create() must be passed at least one keyword argument"

        defaults = kwargs.pop("defaults", {})
        lookup = kwargs.copy()

        try:
            return self.get(**lookup), False
        except self.resource.DoesNotExist:
            params = dict([(k, v) for k, v in kwargs.items()])
            params.update(defaults)

            obj = self.create(**params)
            return obj, True
1194486
def fetchone(self):
        
        row = self._session.fetchone()
        if row:
            return self._row_factory(row)
1239338
def get_or_create(self, key, creation_function, **kw):
        """"""

        return self._ctx_get_or_create(key, creation_function, None, **kw)
907724
def get(self, key):

    

    try:
      try:
        obj = self.bucket.get(key)
      except:
        raise

      return dict(obj or {})

    except:
      raise
914861
def get(self, key):
        

        if not key in self._actions:
            return None
        if not key in self._cache:
            self._cache[key] = self._actions[key]()

        return self._cache[key]
271971
public <T> T get(Key<T> key) {
        checkState(ht);
        Object o = ht.get(key);
        if (o instanceof Factory<?>) {
            Factory<?> fac = (Factory<?>)o;
            o = fac.make(this);
            if (o instanceof Factory<?>)
                throw new AssertionError("T extends Context.Factory");
            Assert.check(ht.get(key) == o);
        }

        /* The following cast can't fail unless there was
         * cheating elsewhere, because of the invariant on ht.
         * Since we found a key of type Key<T>, the value must
         * be of type T.
         */
        return Context.<T>uncheckedCast(o);
    }
463593
def get_from_instance(self, instance):
        
        # walk the attribute path to get the value. Similarly to Django, first
        # try getting the value from a dict, then as a attribute lookup, and
        # then as a list index
        for attr in self._path:
            try: # dict lookup
                instance = instance[attr]
            except (TypeError, AttributeError, KeyError, ValueError, IndexError):
                try: # attr lookup
                    instance = getattr(instance, attr)
                except (TypeError, AttributeError):
                    try:  # list-index lookup
                        instance = instance[int(attr)]
                    except (IndexError,  # list index out of range
                            ValueError,  # invalid literal for int()
                            KeyError,    # current is a dict without `int(bit)` key
                            TypeError):  # unsubscriptable object
                                raise VariableLookupError("Failed lookup for key [%s] in %r" % (attr, instance))

            if callable(instance):
                instance = instance()
            elif instance is None:  # no sense walking down the path any further
                return None

        return instance