Python uuid 模块,_ifconfig_getnode() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用uuid._ifconfig_getnode()

项目:xiboside    作者:ajiwo    | 项目源码 | 文件源码
def __set_identity(self):
        node = None
        if sys.platform == 'win32':
            for getter in [uuid._netbios_getnode, uuid._ipconfig_getnode]:
                node = getter()
                if node:
                    break
        else:
            # Linux only, find mac address using ifconfig command. taken from uuid._ifconfig_getnode
            for args in ('eth0', 'wlan0', 'en0'):  # TODO: other possible network interface name
                node = uuid._find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i + 1)
                if node:
                    break

        if node is None:
            raise RuntimeError("No network interface found.")
        self.__mac_address = ':'.join([str('%012x' % node)[x:x + 2] for x in range(0, 12, 2)])
        url = 'xiboside://%s/%s/%s' % (sys.platform, os.name, self.__mac_address)
        self.__keys['hardware'] = uuid.uuid3(uuid.NAMESPACE_URL, url)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        import sys
        import os
        if os.name == 'posix':
            node = uuid._ifconfig_getnode()
            if node is not None:
                self.check_node(node, 'ifconfig')
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        self.check_node(node, 'ifconfig', True)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        self.check_node(node, 'ifconfig', True)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        if node is not None:
            self.check_node(node, 'ifconfig')
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        if node is not None:
            self.check_node(node, 'ifconfig')
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        self.check_node(node, 'ifconfig', True)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        import sys
        import os
        if os.name == 'posix':
            node = uuid._ifconfig_getnode()
            if node is not None:
                self.check_node(node, 'ifconfig')
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_ifconfig_getnode(self):
        node = uuid._ifconfig_getnode()
        if node is not None:
            self.check_node(node, 'ifconfig')