Copy of ActiveRecord::Fixtures.identify method.
 Returns a consistent, platform-independent identifier for +label+.
 Integer identifiers are values less than 2^30.
 UUIDs are RFC 4122 version 5 SHA-1 hashes.
975602
def identify(label, column_type = :integer)
      if column_type == :uuid
        NamedSeeds.uuid_v5(label)
      else
        Zlib.crc32(label.to_s) % MAX_ID
      end
    end
554173
def IdentifiersIndexer(instance):
    
    identifiers = instance.Schema()['Identifiers'].get(instance)
    return [safe_unicode(i['Identifier']) for i in identifiers]
332657
def fingerprint
      h = Digest::SHA2.new
      h << (self.exclusive ? 'true' : 'false')

      users = self.users.sort { |a, b| a.uuid <=> b.uuid }
      users.each do |u|
        h << format(",(%d,%s,%s,%d,%s",
                    u.uuid, u.common_name,
                    (u.superuser ? 'true' : 'false'),
                    (u.expires_at ? u.expires_at.to_i : 0),
                    u.username)

        u.public_key_fingerprints.each do |fp|
          h << "," << fp
        end
        h << ')'
      end

      h.hexdigest
    end
808116
def create_id(self, prefix="guid"):
        
        if self.method == IDGenerator.METHOD_UUID:
            id_ = str(uuid.uuid4())
        elif self.method == IDGenerator.METHOD_INT:
            id_ = self.next_int
            self.next_int += 1
        else:
            raise InvalidMethodError(self.method)

        return "%s:%s-%s" % (self.namespace.prefix, prefix, id_)
446685
def users
      identifier = ::CurrentUser.identifier

      if identifier.respond_to? :call
        ::User.all.sort { |x,y| identifier.call(x) <=> identifier.call(y) }
      else
        ::User.order identifier.to_s
      end
    end
120757
def identifier
      case @typecode
      when nil
        'void'
      when BOOL
        'char'
      when BYTE
        'char'
      when UBYTE
        'unsigned char'
      when SINT
        'short int'
      when USINT
        'unsigned short int'
      when INT
        'int'
      when UINT
        'unsigned int'
      when SFLOAT
        'float'
      when DFLOAT
        'double'
      else
        if @typecode < Pointer_
          'unsigned char *'
        elsif @typecode < INDEX_
          'int'
        else
          raise "No identifier available for #{@typecode.inspect}"
        end
      end
    end
744637
def check_identifier
      return true unless Gitnesse::Config.instance.annotate_results
      identifier = Gitnesse::Config.instance.identifier
      if identifier.nil? || identifier.empty?
        add_error "You must specify identifier to use the annotate_results option"
      else
        true
      end
    end
1238395
def p_identifier_name_string(self, p):
        
        p[0] = asttypes.PropIdentifier(p[1].value)
        # manually clone the position attributes.
        for k in ('_token_map', 'lexpos', 'lineno', 'colno'):
            setattr(p[0], k, getattr(p[1], k))
692755
def verify_identifiers(identifiers, n_items):
    """"""
    if identifiers is None:
        return identifiers

    identifiers = np.array(identifiers, copy=False)

    # Check length for consistency
    if len(identifiers) != n_items:
        raise ValueError("identifiers has inconsistent dimension.")

    # Check that identifiers are unique
    if len(np.unique(identifiers)) != n_items:
        raise ValueError("identifiers contains duplicate values.")

    return identifiers
546958
def unique_id
      generator = Sass::Script::Functions.random_number_generator
      Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)
      # avoid the temptation of trying to guess the next unique value.
      value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))
      # the u makes this a legal identifier if it would otherwise start with a number.
      identifier("u" + value.to_s(36).rjust(8, '0'))
    end
389603
def _get_persistent_id(self, o):
        
        if type(o) in self.hash_dedup:
            oid = o.__class__.__name__ + "-" + str(hash(o))
            self._object_cache[oid] = o
            return oid

        if any(isinstance(o,c) for c in self.unsafe_key_baseclasses):
            return None

        try:
            return self._uuid_cache[o]
        except KeyError:
            pass
        except TypeError:
            return None

        #if type(o) in self.uuid_dedup:
        #    return self._get_id(o)
        if o.__class__.__module__.split('.')[0] in self.module_dedup or o.__class__ in self.uuid_dedup:
            oid = o.__class__.__name__.split(".")[-1] + '-' + str(uuid.uuid4())
            self._object_cache[oid] = o
            self._uuid_cache[o] = oid
            return oid

        return None
1007732
def finger(self, match, hash_type=None):
        '''
        
        '''
        if hash_type is None:
            hash_type = __opts__['hash_type']

        matches = self.name_match(match, True)
        ret = {}
        for status, keys in six.iteritems(matches):
            ret[status] = {}
            for key in keys:
                if status == 'local':
                    path = os.path.join(self.opts['pki_dir'], key)
                else:
                    path = os.path.join(self.opts['pki_dir'], status, key)
                ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type)
        return ret
1112953
def identify( name: nil, net: nil, cc: nil, imc: nil, ssc: nil, **nn )
      name || { net: net, cc: cc, imc: imc, ssc: ssc }.merge( nn )
    end
959819
def uuid(self):
        '''
        '''
        pk = self.pkvalue()
        if not pk:
            raise self.DoesNotExist(
                'Object not saved. Cannot obtain universally unique id')
        return self.get_uuid(pk)
224938
def _create_identifier(rdtype, name, content):
        
        sha256 = hashlib.sha256()
        sha256.update((rdtype + '/').encode('UTF-8'))
        sha256.update((name + '/').encode('UTF-8'))
        sha256.update(content.encode('UTF-8'))
        return sha256.hexdigest()[0:7]
987952
def lookup_identifier(name)
      if has_rule?(name)
        ident = lookup_rule(name)
      elsif has_terminal?(name)
        ident = @terminals[name]
      else
        ident = nil
      end

      return ident
    end
616929
def field(identifier)
      ensure_loaded do
        fields.each do |f|
          return f if f.identifier == identifier
        end
      end
      
      nil
    end