Returns an instance of the model from a search document id.

        :param doc_id: Search document id
        :return: Instance of cls
516802
def get_from_search_doc(cls, doc_id):
        
        # If the document was passed instead of the doc_id, get the document.
        if hasattr(doc_id, 'doc_id'):
            doc_id = doc_id.doc_id
        return cls.from_urlsafe(doc_id)
623886
def get_instance(self, collection, obj_id, **kwargs):
        
        logging.info("Getting single record")
        try:
            obj_id = ObjectId(obj_id)
        except InvalidId:
            logging.error("Invalid ObjectId: {}".format(obj_id))
            return {}
        projection = kwargs.get('projection', {})
        projection = None if len(projection) < 1 else projection
        query = kwargs.get('query', {})
        query.update({'_id': obj_id})
        logging.debug("Query: {}".format(query))
        logging.debug("Projection: {}".format(projection))
        record = self.db[collection].find_one(query, projection)
        return record
1129957
def get_document(self, id):
        
        obj_list = self.document_list
        matches = [i for i in obj_list if str(i.id) == str(id)]
        if not matches:
            raise DoesNotExistError("The resource you've requested does not \
exist or is unavailable without the proper credentials.")
        return matches[0]
181755
def get(cls, resource_id, include_deactivated=False):
        
        resource = yield cls.db_client().get_doc(resource_id)

        if resource.get('type') != cls.resource_type:
            raise exceptions.NotFound()

        if not include_deactivated and resource.get('state') == State.deactivated.name:
            raise exceptions.NotFound()

        raise Return(cls(**resource))
778432
def get(self, obj_id):
        
        if BasicPage.PAGE_ID_SEPARATOR in obj_id:
            (docid, page_nb) = obj_id.split(BasicPage.PAGE_ID_SEPARATOR)
            page_nb = int(page_nb)
            return self._docs_by_id[docid].pages[page_nb]
        return self._docs_by_id[obj_id]
149091
def document(cls):
    
    if cls.__doc__ is None:
        return cls

    baseclass_name = cls.mro()[-2].__name__

    try:
        return DOC_FUNCTIONS[baseclass_name](cls)
    except KeyError:
        return cls
1318441
def get(self, identifier):
        """"""
        logging.info('Download document with id ' + str(identifier) + '.')
        try:
            record = self.instance.get(index=self.index, doc_type=self.doc_type, id=identifier)
            if '_source' in record:
                return record['_source']
            else:
                return record
        except NotFoundError:
            return None
1300430
def get(self, id):
        """"""
        params = {'q': 'id:%s' % str(id), 'wt': 'python'}
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data['response']['numFound'] > 0:
            return data['response']['docs'][0]
        return None
184002
def get_instance(model, instance_id):
    
    try:
        model = get_model(model)
    except ImportError:
        return None

    return model.query.get(instance_id)
475068
def _get_doc_by_line_offset(self, doc_id):
        
        bounds = self._get_meta()[str(doc_id)].bounds
        return xml_utils.load_chunk(self.filename, bounds, slow=True)
193141
def get_widget_class_from_id(id):
    

    res = id.split('-')
    try:
        model_cls = apps.get_model(res[1], res[2])
    except:
        model_cls = None
    return model_cls
121527
def factory_object(self, index, doc_type, data=None, id=None):
        
        data = data or {}
        obj = self.model()
        obj._meta.index = index
        obj._meta.type = doc_type
        obj._meta.connection = self
        if id:
            obj._meta.id = id
        if data:
            obj.update(data)
        return obj
1276878
def find_by_id(self, _id, **kwargs):
        

        if type(_id) == dict and _id.get("_id"):
            return self.find_one({"_id": ObjectId(_id["_id"])}, **kwargs)

        return self.find_one({"_id": ObjectId(_id)}, **kwargs)
286520
def create_doc_id_from_json(doc) -> str:
        
        return hashlib.sha256(json.dumps(doc, sort_keys=True).encode('utf-8')).hexdigest()
163172
def get(cls, id_):
        """"""
        with db.session.no_autoflush:
            query = cls.dbmodel.query.filter_by(id=id_)
            try:
                model = query.one()
            except NoResultFound:
                raise WorkflowsMissingObject("No object for for id {0}".format(
                    id_
                ))
            return cls(model)
728702
def find_one_by_id(self, _id):
        
        document = (yield self.collection.find_one({"_id": ObjectId(_id)}))
        raise Return(self._obj_cursor_to_dictionary(document))
629045
def get(cls, object_id):
        
        from highton.models.party import Party
        return fields.ListField(name=Party.ENDPOINT, init_class=Party).decode(
            cls.element_from_string(
                cls._get_request(endpoint=cls.ENDPOINT + '/' + str(object_id)).text
            )
        )