Get an object from the database given an entity and the session key.

    :param entity: Class type of the object to retrieve.
    :param key: Array that defines the path of the value inside the message.
975159
def get_object_from_session(entity, key):
    
    def object_from_session_function(service, message):
        """Actual implementation of get_object_from_session function.

        :param service: SelenolService object.
        :param message: SelenolMessage request.
        """
        id_ = get_value_from_session(key)(service, message)
        result = service.session.query(entity).get(id_)
        if not result:
            raise SelenolInvalidArgumentException(key, id_)
        return result
    return object_from_session_function
1187986
async def get_entity(self):
        
        if not self.entity and await self.get_input_entity():
            try:
                self._entity =\
                    await self._client.get_entity(self._input_entity)
            except ValueError:
                pass

        return self._entity
284220
def get(self, key):  
        
        res = self.connection.get(key)
        print(res)
        return res
666177
@PostMapping(
      value = "/{entityTypeId}/{id}",
      params = "_method=GET",
      produces = APPLICATION_JSON_VALUE)
  @ResponseBody
  public Map<String, Object> retrieveEntity(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @Valid @RequestBody EntityTypeRequest request) {
    Set<String> attributesSet = toAttributeSet(request != null ? request.getAttributes() : null);
    Map<String, Set<String>> attributeExpandSet =
        toExpandMap(request != null ? request.getExpand() : null);

    EntityType meta = dataService.getEntityType(entityTypeId);
    Object id = getTypedValue(untypedId, meta.getIdAttribute());
    Entity entity = dataService.findOneById(entityTypeId, id);

    if (entity == null) {
      throw new UnknownEntityException(meta, untypedId);
    }

    return getEntityAsMap(entity, meta, attributesSet, attributeExpandSet);
  }
588142
def get_for_obj(self, entity_model_obj):
        
        return self.get(entity_type=ContentType.objects.get_for_model(
            entity_model_obj, for_concrete_model=False), entity_id=entity_model_obj.id)
137130
def get_item(self, key):
        
        result = self._db.search(self._urls.key == key)
        return result[0].get('url') if result else None
202323
@Override
    public Object find(Class entityClass, Object key)
    {

        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);

        Object e = r.db(entityMetadata.getSchema()).table(entityMetadata.getTableName()).get(key).run(connection,
                entityClass);

        PropertyAccessorHelper.setId(e, entityMetadata, key);

        return e;
    }
1266459
def _get_path(entity_id):
    '''
    '''
    try:
        path = entity_id.path()
    except AttributeError:
        path = entity_id
    if path.startswith('cs:'):
        path = path[3:]
    return path
926262
def get_entity(self):
        
        if self._accessor is None:
            if self.__converted_entity is None:
                self.__converted_entity = self._convert_to_entity()
        else:
            # If we have an accessor, we can get the proxied entity by ID.
            # FIXME: This is a hack that is only used for REMOVE operations
            #        with data elements.
            self.__converted_entity = \
                self.get_matching(self.get_id()).get_entity()
        return self.__converted_entity
690708
def get(self, object_id, cls=None):
        
        cls = self.cls if cls is None else cls
        return self.session.query(cls).get(object_id)
601136
def get(self, key):
    '''
    '''
    self.logger.info('%s: get %s' % (self, key))
    value = super(LoggingDatastore, self).get(key)
    self.logger.debug('%s: %s' % (self, value))
    return value
533598
def entity(self, attr, schema=None):
        
        try:
            return self._cache[attr]
        except KeyError, ke:
            return self.map_to(attr, tablename=attr, schema=schema)
534740
@Override
    public Object find(Class entityClass, Object key)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                entityMetadata.getPersistenceUnit());

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());

        return managedType.hasLobAttribute() ? findGFSEntity(entityMetadata, entityClass, key) : find(entityClass, key,
                entityMetadata, metaModel, managedType);
    }
1359210
def get_object_from_content(entity, key):
    
    def object_from_content_function(service, message):
        """Actual implementation of get_object_from_content function.

        :param service: SelenolService object.
        :param message: SelenolMessage request.
        """
        id_ = get_value_from_content(key)(service, message)
        result = service.session.query(entity).get(id_)
        if not result:
            raise SelenolInvalidArgumentException(key, id_)
        return result
    return object_from_content_function
497487
def object(self, session):
        ''''''
        if not hasattr(self, '_object'):
            pkname = self.model_type._meta.pkname()
            query = session.query(self.model_type).filter(**{pkname:
                                                             self.object_id})
            return query.items(callback=self.__set_object)
        else:
            return self._object
1195476
def entity(path: Union[str, pathlib.Path]) -> _Entity:
    
    return _Entity.from_path(_normalise_path(path))
202032
def to_entity(entity_type, value, fields):
    
    e = entity_type(value)
    for k, v in fields.items():
        e.fields[k] = Field(k, v)
    return e