Gets the ``Composition``  ``Id`` corresponding to this asset.

        return: (osid.id.Id) - the composiiton ``Id``
        raise:  IllegalState - ``is_composition()`` is ``false``
        *compliance: mandatory -- This method must be implemented.*
333604
def get_composition_id(self):
        
        # Implemented from template for osid.learning.Activity.get_objective_id
        if not bool(self._my_map['compositionId']):
            raise errors.IllegalState('composition empty')
        return Id(self._my_map['compositionId'])
926000
def getById(self, Id):
        
        # we need to create a new object to insure we don't corrupt the generator count
        csvsource = CSVSource(self.source, self.factory, self.key())
        try:
            for item in csvsource.items():
                if Id == item.getId():
                    return item
        except StopIteration:
            return None
578098
def verify(self, id):
        
        url = self._url('%s/verify' % (id))
        return self.client.post(url)
1171504
def get_class_by_id(self, ac_id: int) -> AssetClass:
        
        assert isinstance(ac_id, int)

        # iterate recursively
        for ac in self.asset_classes:
            if ac.id == ac_id:
                return ac
        # if nothing returned so far.
        return None
749045
def get(self, id):
        
        id = utils.lowerFirst(id)
        if id in self._settings:
            return self._settings[id]
        raise NotFound('Invalid setting id: %s' % id)
1147937
def get_id(self):
        """"""

        # Check first to make sure no one else has claimed authority on my object.
        # This will likely occur when an AssessmentSection returns a Question
        # During an AssessmentSession
        if self.my_osid_object._authority != MAGIC_AUTHORITY:
            return self.my_osid_object._item_id
            # raise AttributeError

        # If not, go ahead and build magic Id:
        choices = self.my_osid_object._my_map['choices']
        choice_ids = [c['id'] for c in choices]
        magic_identifier = quote('{0}?{1}'.format(self.my_osid_object._my_map['_id'],
                                                  json.dumps(choice_ids)))
        return Id(namespace='assessment.Item',
                  identifier=magic_identifier,
                  authority=MAGIC_AUTHORITY)
834679
def id
      id_attr = resource[:id]
      return id_attr.to_s if id_attr.present? && id_attr.is_a?(::Valkyrie::ID) && !id_attr.blank?
      return "" unless resource.respond_to?(:alternate_ids)
      resource.alternate_ids.first.to_s
    end
1140860
def get(self, id):
        
        url = self._url('%s' % (id))
        return self.client.get(url)
143303
def type_id(self):
        
        try:
            return ContentType.objects.get_for_model(self.model, for_concrete_model=False).id
        except DatabaseError as e:
            raise DatabaseError("Unable to fetch ContentType object, is a plugin being registered before the initial syncdb? (original error: {0})".format(str(e)))
447985
def valid_id(opts, id_):
    '''
    
    '''
    try:
        if any(x in id_ for x in ('/', '\\', str('\0'))):
            return False
        return bool(clean_path(opts['pki_dir'], id_))
    except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
        return False
654100
def _get_id(self, id_, pkg_name):
        
        collection = JSONClientValidated('id',
                                         collection=pkg_name + 'Ids',
                                         runtime=self._runtime)
        try:
            result = collection.find_one({'aliasIds': {'$in': [str(id_)]}})
        except errors.NotFound:
            return id_
        else:
            return Id(result['_id'])
764388
def asset(self, id):
        
        data = None
        if int(id) > 0:
            url = self._build_url('releases', 'assets', str(id),
                                  base_url=self._api)
            data = self._json(self._get(url, headers=Release.CUSTOM_HEADERS),
                              200)
        return Asset(data, self) if data else None
1290541
def id(self):
        
        if self._id is None:
            self._id = int(self._element.get('id'))
        return self._id
977978
def get_by_id(self, style_id, style_type):
        
        if style_id is None:
            return self.default(style_type)
        return self._get_by_id(style_id, style_type)
280450
def usable_id(cls, id):
        
        try:
            qry_id = int(id)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
753377
def _ensure_object_id(cls, id):
        """"""
        if isinstance(id, ObjectId):
            return id

        if isinstance(id, basestring) and OBJECTIDEXPR.match(id):
            return ObjectId(id)

        return id
841837
def _get_one(self, id):
        
        try:
            return self._to_dict(models.User.objects.get(pk=id))
        except models.User.DoesNotExist:
            raise errors.NotFound()