• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python thread._get_ident函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thread._get_ident函数的典型用法代码示例。如果您正苦于以下问题:Python _get_ident函数的具体用法?Python _get_ident怎么用?Python _get_ident使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_get_ident函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:DataCanvasIO,项目名称:example-modules,代码行数:10,代码来源:fix-version.py


示例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
开发者ID:18965050,项目名称:gevent,代码行数:9,代码来源:lock.py


示例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]
开发者ID:LAlbertalli,项目名称:py-unicode-collation,代码行数:9,代码来源:unicode_dict.py


示例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]
开发者ID:crackwitz,项目名称:videozeug,代码行数:10,代码来源:odict.py


示例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]
开发者ID:hartym,项目名称:rdc.etl,代码行数:11,代码来源:hash.py


示例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]
开发者ID:jelloslinger,项目名称:rdc.etl,代码行数:11,代码来源:hash.py


示例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]
开发者ID:Claire-Ling-Liu,项目名称:scikit-learn,代码行数:12,代码来源:odict.py


示例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]
开发者ID:richardmarshall,项目名称:apiframework,代码行数:12,代码来源:collections_local.py


示例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)
开发者ID:klahnakoski,项目名称:SpotManager,代码行数:12,代码来源:busy_lock.py


示例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]
开发者ID:gcgirish-radisys,项目名称:voltha,代码行数:13,代码来源:structlog_setup.py


示例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]
开发者ID:davvid,项目名称:git-cola,代码行数:13,代码来源:ordered_dict.py


示例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]
开发者ID:ohmu,项目名称:poni,代码行数:13,代码来源:orddict.py


示例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]
开发者ID:LAlbertalli,项目名称:py-unicode-collation,代码行数:13,代码来源:unicode_set.py


示例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]
开发者ID:runt18,项目名称:requests,代码行数:14,代码来源:ordered_dict.py


示例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]
开发者ID:0x68,项目名称:corduroy,代码行数:17,代码来源:atoms.py


示例16: wrapper

        def wrapper(self):
            me = _get_ident()
            try:
                count = self._locking[me]
            except KeyError:
                count = self._locking[me] = 1
            else:
                count = self._locking[me] = count + 1
            if count:
                return

            try:
                return f(self)
            finally:
                count = count - 1
                if not count:
                    del self._locking[me]
                else:
                    self._locking[me] = count
开发者ID:18965050,项目名称:gevent,代码行数:19,代码来源:lock.py


示例17: __repr__

    def __repr__(self, _repr_running={}, fn=__drepr__):
        """ Wrapped around __drepr__ that makes it possible to
        represent infinitely-recursive dictionaries of this type. """
        # NOTE: version variety; might be a _get_ident or something else.
        try:
            from thread import get_ident as _get_ident
        except ImportError:
            from threading import get_ident as _get_ident

        call_key = (id(self), _get_ident())
        if call_key in _repr_running:
            # TODO?: make a YAML-like naming & referencing?
            # (too complicated for a repr() though)
            return '...'
        _repr_running[call_key] = 1
        try:
            return fn(self)
        finally:
            del _repr_running[call_key]
开发者ID:HoverHell,项目名称:pyaux,代码行数:19,代码来源:dicts.py


示例18: __setitem__

 def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
     if _get_ident() in self.__insertions_running:
         self.__insertions_running[_get_ident()] = key, value
     else:
         super(ListDict, self).__setitem__(key, value, dict_setitem)
开发者ID:DataCanvasIO,项目名称:example-modules,代码行数:5,代码来源:fix-version.py



注:本文中的thread._get_ident函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python thread.allocate函数代码示例发布时间:2022-05-27
下一篇:
Python thread._count函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap