Return a Python-friendly id
961094
def pythonise(id, encoding='ascii'):
    """"""
    replace = {'-': '_', ':': '_', '/': '_'}
    func = lambda id, pair: id.replace(pair[0], pair[1])
    id = reduce(func, replace.iteritems(), id)
    id = '_%s' % id if id[0] in string.digits else id
    return id.encode(encoding)
373117
def _make_safe_id(self, id):
        

        substitutions = {
            '-': '_DASH_',
            '/': '_FSLASH_',
            '\\': '_BSLASH_',
            '(': '_LPAREN_',
            ')': '_RPAREN_',
            '[': '_LSQBKT_',
            ']': '_RSQBKT_',
            ',': '_COMMA_',
            '.': '_PERIOD_',
            "'": '_APOS_'
        }

        id = re.sub(r'\(([a-z])\)$', '_\\1', id)
        for symbol, escape in iteritems(substitutions):
            id = id.replace(symbol, escape)
        id = re.sub(r'[^a-zA-Z0-9_]', '', id)
        return id
220160
def id(self):
        """"""
        dev_id = ''
        if self._is_x10:
            dev_id = 'x10{}{:02d}'.format(self.x10_housecode,
                                          self.x10_unitcode)
        else:
            dev_id = self.hex
        return dev_id
274853
def get_id(self):
        
        if self._id is None:
            # FIXME: provide a better error message when key is not defined
            self._id = self.inspect(refresh=False)["Id"]
        return self._id
780475
def t_ID(t):
    '
    t.type = reserved.get(t.value.lower(), 'ID')
    callables = {
        api.constants.CLASS.array: 'ARRAY_ID',
    }

    if t.type != 'ID':
        t.value = t.type
    else:
        entry = api.global_.SYMBOL_TABLE.get_entry(t.value) if api.global_.SYMBOL_TABLE is not None else None
        if entry:
            t.type = callables.get(entry.class_, t.type)

    if t.type == 'BIN':
        t.lexer.begin('bin')
        return None

    return t
772133
def get_id(self):
        
        import warnings
        warnings.warn('{0}.get_id() is deprecated, '
                      'use {0}.id instead'.format(type(self).__name__),
                      DeprecationWarning)
        return self.get('_id')
1072898
def t_ID(self, t):
        """

        # If the value is a reserved name, give it the appropriate type (not ID)
        if t.value in self.reserved:
            t.type = self.reserved[t.value]

        # If it's a function, give it the FUNC type
        elif t.value in self.functions:
            t.type = 'FUNC'

        return t
1051900
def _printable_id_code(self):
        
        code = str(self.id_code)
        while len(code) < self._code_size:
            code = '0' + code

        return code
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
931628
def iddofobject(data, commdct, key):
    """"""
    dtls = data.dtls
    i = dtls.index(key)
    return commdct[i]
544520
def int_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, int):
            return id_or_name
        return None
263193
def get_obj_id(self, item):
        
        if item is not None:
            if isinstance(item, six.string_types):
                return item
            elif hasattr(item, 'id'):
                return item.id
556966
def _random_id(self, size=16, chars=string.ascii_uppercase + string.digits):
        
        return ''.join(random.choice(chars) for _ in range(size))
322403
def get_id(self):
        """"""

        # This function is used by Flask-Login to store a User ID securely as a browser cookie.
        # The last part of the password is included to invalidate tokens when password change.
        # user_id and password_ends_with are encrypted, timestamped and signed.
        # This function works in tandem with UserMixin.get_user_by_token()
        user_manager = current_app.user_manager

        user_id = self.id
        password_ends_with = '' if user_manager.USER_ENABLE_AUTH0 else self.password[-8:]
        user_token = user_manager.generate_token(
            user_id,               # User ID
            password_ends_with,    # Last 8 characters of user password
        )
        # print("UserMixin.get_id: ID:", self.id, "token:", user_token)
        return user_token
1131467
def get_id(self):
        """"""
        if self._id_attr is None or not hasattr(self, self._id_attr):
            return None
        return getattr(self, self._id_attr)
240463
def id(cls):
        
        if cls.__uuid_primary_key__:
            return immutable(Column(UUIDType(binary=False), default=uuid_.uuid4, primary_key=True, nullable=False))
        else:
            return immutable(Column(Integer, primary_key=True, nullable=False))
38770
def id(self):
        """"""
        id = self.element.attrib[GML_NS + 'id']
        code = id.split('-')[-1]
        return code