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

Python zmq.pyzmq_version_info函数代码示例

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

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



在下文中一共展示了pyzmq_version_info函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_pyzmq_version_info

 def test_pyzmq_version_info(self):
     version = zmq.sugar.version
     save = version.__version__
     try:
         version.__version__ = '2.10dev'
         info = zmq.pyzmq_version_info()
         self.assertTrue(isinstance(info, tuple))
         self.assertEquals(len(info), 3)
         self.assertTrue(info > (2,10,99))
         self.assertEquals(info, (2,10,float('inf')))
         version.__version__ = '2.1.10'
         info = zmq.pyzmq_version_info()
         self.assertEquals(info, (2,1,10))
         self.assertTrue(info > (2,1,9))
     finally:
         version.__version__ = save
开发者ID:chiehwen,项目名称:pyzmq,代码行数:16,代码来源:test_version.py


示例2: _zmq_has_curve

def _zmq_has_curve():
    """
    Return whether the current ZMQ has support for auth and CurveZMQ security.

    :rtype: bool

     Version notes:
       `zmq.curve_keypair()` is new in version 14.0, new in version libzmq-4.0.
            Requires libzmq (>= 4.0) to have been linked with libsodium.
       `zmq.auth` module is new in version 14.1
       `zmq.has()` is new in version 14.1, new in version libzmq-4.1.
    """
    zmq_version = zmq.zmq_version_info()
    pyzmq_version = zmq.pyzmq_version_info()

    if pyzmq_version >= (14, 1, 0) and zmq_version >= (4, 1):
        return zmq.has('curve')

    if pyzmq_version < (14, 1, 0):
        return False

    if zmq_version < (4, 0):
        # security is new in libzmq 4.0
        return False

    try:
        zmq.curve_keypair()
    except zmq.error.ZMQError:
        # security requires libzmq to be linked against libsodium
        return False

    return True
开发者ID:PaixuAabuizia,项目名称:bitmask_client,代码行数:32,代码来源:utils.py


示例3: check_for_pyzmq

def check_for_pyzmq():
    try:
        import zmq
    except ImportError:
        print_status('pyzmq', "no (required for qtconsole, notebook, and parallel computing capabilities)")
        return False
    else:
        # pyzmq 2.1.10 adds pyzmq_version_info funtion for returning
        # version as a tuple
        if hasattr(zmq, 'pyzmq_version_info'):
            if zmq.pyzmq_version_info() >= (2,1,4):
                print_status("pyzmq", zmq.__version__)
                return True
            else:
                # this branch can never occur, at least until we update our
                # pyzmq dependency beyond 2.1.10
                return False
        # this is necessarily earlier than 2.1.10, so string comparison is
        # okay
        if zmq.__version__ < '2.1.4':
            print_status('pyzmq', "no (have %s, but require >= 2.1.4 for"
            " qtconsole and parallel computing capabilities)"%zmq.__version__)
            return False
        else:
            print_status("pyzmq", zmq.__version__)
            return True
开发者ID:ArvindhSomanathan,项目名称:ipython,代码行数:26,代码来源:setupext.py


示例4: enable_monitor

    def enable_monitor(self, events=None):

        # The standard approach of binding and then connecting does not
        # work in this specific case. The event loop does not properly
        # detect messages on the inproc transport which means that event
        # messages get missed.
        # pyzmq's 'get_monitor_socket' method can't be used because this
        # performs the actions in the wrong order for use with an event
        # loop.
        # For more information on this issue see:
        # http://lists.zeromq.org/pipermail/zeromq-dev/2015-July/029181.html

        if (zmq.zmq_version_info() < (4,) or
                zmq.pyzmq_version_info() < (14, 4,)):
            raise NotImplementedError(
                "Socket monitor requires libzmq >= 4 and pyzmq >= 14.4, "
                "have libzmq:{}, pyzmq:{}".format(
                    zmq.zmq_version(), zmq.pyzmq_version()))

        if self._monitor is None:
            addr = "inproc://monitor.s-{}".format(self._zmq_sock.FD)
            events = events or zmq.EVENT_ALL
            _, self._monitor = yield from create_zmq_connection(
                lambda: _ZmqEventProtocol(self._loop, self._protocol),
                zmq.PAIR, connect=addr, loop=self._loop)
            # bind must come after connect
            self._zmq_sock.monitor(addr, events)
            yield from self._monitor.wait_ready
开发者ID:TadLeonard,项目名称:aiozmq,代码行数:28,代码来源:core.py


示例5: test_pyzmq_version_info

 def test_pyzmq_version_info(self):
     info = zmq.pyzmq_version_info()
     self.assertTrue(isinstance(info, tuple))
     for n in info[:3]:
         self.assertTrue(isinstance(n, int))
     if version.VERSION_EXTRA:
         self.assertEqual(len(info), 4)
         self.assertEqual(info[-1], float('inf'))
     else:
         self.assertEqual(len(info), 3)
开发者ID:Bluehorn,项目名称:pyzmq,代码行数:10,代码来源:test_version.py


示例6: init_signal

 def init_signal(self):
     # FIXME: remove this check when pyzmq dependency is >= 2.1.11
     # safely extract zmq version info:
     try:
         zmq_v = zmq.pyzmq_version_info()
     except AttributeError:
         zmq_v = [ int(n) for n in re.findall(r'\d+', zmq.__version__) ]
         if 'dev' in zmq.__version__:
             zmq_v.append(999)
         zmq_v = tuple(zmq_v)
     if zmq_v >= (2,1,9):
         # This won't work with 2.1.7 and
         # 2.1.9-10 will log ugly 'Interrupted system call' messages,
         # but it will work
         signal.signal(signal.SIGINT, self._handle_sigint)
     signal.signal(signal.SIGTERM, self._signal_stop)
开发者ID:catchmrbharath,项目名称:ipython,代码行数:16,代码来源:notebookapp.py


示例7: check_for_pyzmq

def check_for_pyzmq():
    try:
        import zmq
    except ImportError:
        print_status('pyzmq', "no (required for qtconsole, notebook, and parallel computing capabilities)")
        return False
    else:
        # pyzmq 2.1.10 adds pyzmq_version_info funtion for returning
        # version as a tuple
        if hasattr(zmq, 'pyzmq_version_info') and zmq.pyzmq_version_info() >= (2,1,11):
                print_status("pyzmq", zmq.__version__)
                return True
        else:
            print_status('pyzmq', "no (have %s, but require >= 2.1.11 for"
            " qtconsole, notebook, and parallel computing capabilities)" % zmq.__version__)
            return False
开发者ID:Andrewkind,项目名称:Turtle-Ipython,代码行数:16,代码来源:setupext.py


示例8: init_signal

 def init_signal(self):
     # FIXME: remove this check when pyzmq dependency is >= 2.1.11
     # safely extract zmq version info:
     try:
         zmq_v = zmq.pyzmq_version_info()
     except AttributeError:
         zmq_v = [ int(n) for n in re.findall(r'\d+', zmq.__version__) ]
         if 'dev' in zmq.__version__:
             zmq_v.append(999)
         zmq_v = tuple(zmq_v)
     if zmq_v >= (2,1,9) and not sys.platform.startswith('win'):
         # This won't work with 2.1.7 and
         # 2.1.9-10 will log ugly 'Interrupted system call' messages,
         # but it will work
         signal.signal(signal.SIGINT, self._handle_sigint)
     signal.signal(signal.SIGTERM, self._signal_stop)
     if hasattr(signal, 'SIGUSR1'):
         # Windows doesn't support SIGUSR1
         signal.signal(signal.SIGUSR1, self._signal_info)
     if hasattr(signal, 'SIGINFO'):
         # only on BSD-based systems
         signal.signal(signal.SIGINFO, self._signal_info)
开发者ID:Jizhong,项目名称:ipython,代码行数:22,代码来源:notebookapp.py


示例9: get_esky_freezer_includes

    def get_esky_freezer_includes(self):
        # Sometimes the auto module traversal doesn't find everything, so we
        # explicitly add it. The auto dependency tracking especially does not work for
        # imports occurring in salt.modules, as they are loaded at salt runtime.
        # Specifying includes that don't exist doesn't appear to cause a freezing
        # error.
        freezer_includes = [
            'zmq.core.*',
            'zmq.utils.*',
            'ast',
            'csv',
            'difflib',
            'distutils',
            'distutils.version',
            'numbers',
            'json',
            'M2Crypto',
            'Cookie',
            'asyncore',
            'fileinput',
            'sqlite3',
            'email',
            'email.mime.*',
            'requests',
            'sqlite3',
        ]
        if HAS_ZMQ and hasattr(zmq, 'pyzmq_version_info'):
            if HAS_ZMQ and zmq.pyzmq_version_info() >= (0, 14):
                # We're freezing, and when freezing ZMQ needs to be installed, so this
                # works fine
                if 'zmq.core.*' in freezer_includes:
                    # For PyZMQ >= 0.14, freezing does not need 'zmq.core.*'
                    freezer_includes.remove('zmq.core.*')

        if IS_WINDOWS_PLATFORM:
            freezer_includes.extend([
                'imp',
                'win32api',
                'win32file',
                'win32con',
                'win32com',
                'win32net',
                'win32netcon',
                'win32gui',
                'win32security',
                'ntsecuritycon',
                'pywintypes',
                'pythoncom',
                '_winreg',
                'wmi',
                'site',
                'psutil',
            ])
        elif sys.platform.startswith('linux'):
            freezer_includes.append('spwd')
            try:
                import yum  # pylint: disable=unused-variable
                freezer_includes.append('yum')
            except ImportError:
                pass
        elif sys.platform.startswith('sunos'):
            # (The sledgehammer approach)
            # Just try to include everything
            # (This may be a better way to generate freezer_includes generally)
            try:
                from bbfreeze.modulegraph.modulegraph import ModuleGraph
                mgraph = ModuleGraph(sys.path[:])
                for arg in glob.glob('salt/modules/*.py'):
                    mgraph.run_script(arg)
                for mod in mgraph.flatten():
                    if type(mod).__name__ != 'Script' and mod.filename:
                        freezer_includes.append(str(os.path.basename(mod.identifier)))
            except ImportError:
                pass
            # Include C extension that convinces esky to package up the libsodium C library
            # This is needed for ctypes to find it in libnacl which is in turn needed for raet
            # see pkg/smartos/esky/sodium_grabber{.c,_installer.py}
            freezer_includes.extend([
                'sodium_grabber',
                'ioflo',
                'raet',
                'libnacl',
            ])
        return freezer_includes
开发者ID:iquaba,项目名称:salt,代码行数:84,代码来源:setup.py


示例10: hasattr

    'ast',
    'difflib',
    'distutils',
    'distutils.version',
    'numbers',
    'json',
    'M2Crypto',
    'Cookie',
    'asyncore',
    'fileinput',
    'email',
    'email.mime.*',
]

if HAS_ZMQ and hasattr(zmq, 'pyzmq_version_info'):
    if HAS_ZMQ and zmq.pyzmq_version_info() >= (0, 14):
        # We're freezing, and when freezing ZMQ needs to be installed, so this
        # works fine
        if 'zmq.core.*' in FREEZER_INCLUDES:
            # For PyZMQ >= 0.14, freezing does not need 'zmq.core.*'
            FREEZER_INCLUDES.remove('zmq.core.*')

if IS_WINDOWS_PLATFORM:
    FREEZER_INCLUDES.extend([
        'win32api',
        'win32file',
        'win32con',
        'win32com',
        'win32net',
        'win32netcon',
        'win32gui',
开发者ID:bemehow,项目名称:salt,代码行数:31,代码来源:setup.py


示例11: main

    # The socket monitor can be explicitly disabled if necessary.
    # yield from ct.disable_monitor()

    # If a socket monitor is left enabled on a socket being closed,
    # the socket monitor will be closed automatically.
    ct.close()
    yield from cp.wait_closed

    st.close()
    yield from sp.wait_closed


def main():
    asyncio.get_event_loop().run_until_complete(go())
    print("DONE")


if __name__ == '__main__':
    # import logging
    # logging.basicConfig(level=logging.DEBUG)

    if (zmq.zmq_version_info() < (4,) or
            zmq.pyzmq_version_info() < (14, 4,)):
        raise NotImplementedError(
            "Socket monitor requires libzmq >= 4 and pyzmq >= 14.4, "
            "have libzmq:{}, pyzmq:{}".format(
                zmq.zmq_version(), zmq.pyzmq_version()))

    main()
开发者ID:TadLeonard,项目名称:aiozmq,代码行数:29,代码来源:socket_event_monitor.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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