本文整理汇总了Python中thread._get_ident函数的典型用法代码示例。如果您正苦于以下问题:Python _get_ident函数的具体用法?Python _get_ident怎么用?Python _get_ident使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_ident函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __insertion
def __insertion(self, link_prev, key_value):
self.__insertions_running[_get_ident()] = 1
self.__setitem__(*key_value)
key, value = self.__insertions_running.pop(_get_ident())
if link_prev[2] != key:
if key in self:
del self[key]
link_next = link_prev[1]
self._OrderedDict__map[key] = link_prev[1] = link_next[0] = [link_prev, link_next, key]
dict.__setitem__(self, key, value)
示例2: acquire
def acquire(self):
me = _get_ident()
if self._owner == me:
self._count += 1
return
self._owner = me
self._block.acquire()
self._count = 1
示例3: __repr__
def __repr__(self, _repr_running={}):
call_key = id(self), _get_ident()
if call_key in _repr_running:
return "..."
_repr_running[call_key] = 1
try:
return "%s(%s, %r)" % (self.__class__.__name__, self.default_factory, dict(self.items()))
finally:
del _repr_running[call_key]
示例4: __repr__
def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
return '{%s}' % (', '.join('%r: %r' % (k,v) for k,v in self.iteritems()))
finally:
del _repr_running[call_key]
示例5: __repr__
def __repr__(self, _repr_running={}):
call_key = id(self), _get_ident()
if call_key in _repr_running:
return "..."
_repr_running[call_key] = 1
try:
if not self:
return "H{}" % ()
return "H{%s}" % (", ".join(["%r: %r" % (k, v) for k, v in self.iteritems()]),)
finally:
del _repr_running[call_key]
示例6: __repr__
def __repr__(self, _repr_running={}):
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return 'H{}' % ()
return 'H{%s}' % (', '.join(['%r: %r' % (k, v, ) for k, v in self.iteritems()]), )
finally:
del _repr_running[call_key]
示例7: __repr__
def __repr__(self, _repr_running={}):
"od.__repr__() <==> repr(od)"
call_key = id(self), _get_ident()
if call_key in _repr_running:
return "..."
_repr_running[call_key] = 1
try:
if not self:
return "%s()" % (self.__class__.__name__,)
return "%s(%r)" % (self.__class__.__name__, self.items())
finally:
del _repr_running[call_key]
示例8: __repr__
def __repr__(self, _repr_running={}): #pylint: disable=W0102
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
finally:
del _repr_running[call_key]
示例9: __enter__
def __enter__(self):
id = _get_ident()
lock = self.lock
while True:
v = _get(lock, 0)
if not v:
_set(lock, 0, id)
elif v == id:
break
else:
sleep(0.000001)
示例10: __repr__
def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '{}'
return '{%s}' % ", ".join("%s: %s" % (k, v)
for k, v in self.items())
finally:
del _repr_running[call_key]
示例11: __repr__
def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
items = list(self.items())
return '%s(%r)' % (self.__class__.__name__, items)
finally:
del _repr_running[call_key]
示例12: __repr__
def __repr__(self, _repr_running=None):
'od.__repr__() <==> repr(od)'
_repr_running = {} if _repr_running is None else _repr_running
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
finally:
del _repr_running[call_key]
示例13: __repr__
def __repr__(self, _repr_running={}):
'''x.__repr__() <==> repr(x)
'''
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.__values.values())
finally:
del _repr_running[call_key]
示例14: __repr__
def __repr__(self, _repr_running=None):
'od.__repr__() <==> repr(od)'
if _repr_running is None:
_repr_running = {}
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '{0!s}()'.format(self.__class__.__name__)
return '{0!s}({1!r})'.format(self.__class__.__name__, self.items())
finally:
del _repr_running[call_key]
示例15: __repr__
def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return u'{}'
contents = []
for k,v in self.items():
contents.append(u'%s:%s'%(k,v))
return u"{%s}"%", ".join(contents)
finally:
del _repr_running[call_key]