Return the padded hexadecimal id of ``obj``.
504297
def _raw_hex_id(obj):
    """"""
    # interpret as a pointer since that's what really what id returns
    packed = struct.pack('@P', id(obj))
    return ''.join(map(_replacer, packed))
1144684
def _lengstr(obj):
    '''
    '''
    n = leng(obj)
    if n is None:  # no len
       r = ''
    elif n > _len(obj):  # extended
       r = ' leng %d!' % n
    else:
       r = ' leng %d' % n
    return r
1003274
def _str(obj):
    """"""
    values = []
    for name in obj._attribs:
        val = getattr(obj, name)
        if isinstance(val, str):
            val = repr(val)
        val = str(val) if len(str(val)) < 10 else "(...)"
        values.append((name, val))
    values = ", ".join("{}={}".format(k, v) for k, v in values)
    return "{}({})".format(obj.__class__.__name__, values)
1090276
def str_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, str):
            return id_or_name
        return None
540547
def paddedInt(i):
    '''
    
    '''
    i_str = str(i)
    pad = PAD_LEN - len(i_str)
    return (pad * "0") + i_str
476828
def decode_cpu_id(self, cpuid):
        """"""
        ret = ()
        for i in cpuid.split(':'):
            ret += (eval('0x' + i),)

        return ret
265666
def id_fix(value):
    
    if value.startswith('KSC_M'):
        pass
    else:
        value = value.replace(':','_')
        if value.startswith('ERO') or value.startswith('OBI') or value.startswith('GO') or value.startswith('UBERON') or value.startswith('IAO'):
            value = 'obo:' + value
        elif value.startswith('birnlex') or value.startswith('nlx'):
            value = 'NIFSTD:' + value
        elif value.startswith('MESH'):
            value = ':'.join(value.split('_'))
        else:
            value = ':' + value

    return OntId(value).URIRef
508753
def statsId(obj):
  """"""
  if hasattr(obj, ID_KEY):
    return getattr(obj, ID_KEY)
  newId = next(NEXT_ID)
  setattr(obj, ID_KEY, newId)
  return newId
1013582
def uniqueID(size=6, chars=string.ascii_uppercase + string.digits):
    """"""
    return ''.join(random.choice(chars) for x in xrange(size))
358345
def ensure_string(obj):
    

    if sys.version_info < (3, 2, 0) and isinstance(obj, unicode):
        return str(obj.encode('utf8'))
    else:
        return obj
858631
def get_id(id_or_obj):
    
    if isinstance(id_or_obj, six.string_types + (int,)):
        # It's an ID
        return id_or_obj
    try:
        return id_or_obj.id
    except AttributeError:
        return id_or_obj
391342
def id_maker(obj):
    
    dtfmt = '%Y%m%d-%H%M%S'
    return '%s-%s' % (obj.__class__.__name__, datetime.now().strftime(dtfmt))
634647
def not_a_string(obj):
    """"""
    my_type = str(type(obj))
    if is_py3():
        is_str = my_type.find('bytes') < 0 and my_type.find('str') < 0
        return is_str

    return my_type.find('str') < 0 and \
        my_type.find('unicode') < 0
324074
def get_numeric_value_property(value, is_bytes=False):
    """"""

    obj = unidata.ascii_numeric_values if is_bytes else unidata.unicode_numeric_values

    if value.startswith('^'):
        negated = value[1:]
        value = '^' + unidata.unicode_alias['numericvalue'].get(negated, negated)
    else:
        value = unidata.unicode_alias['numericvalue'].get(value, value)

    return obj[value]
1083874
public static ObjectId readObjectId(String bytesInHex) {
      byte[] bytes = new byte[12];
      assert bytesInHex.length() == 24;
      for (int i = 0, index = 0; i != 12; ++i) {
         String hexChar = bytesInHex.substring(index, index += 2);
         bytes[i] = (byte) Integer.parseInt(hexChar, 16);
      }
      return readObjectId(bytes);
   }
957556
def get_obj_doc0(obj, alt="(no doc)"):
    """"""
    ret = obj.__doc__.strip().split("\n")[0] if obj.__doc__ is not None else alt
    return ret
12439
def ishex(obj):
    
    return isinstance(obj, str) and (len(obj) == 1) and (obj in string.hexdigits)