當前位置: 首頁>>代碼示例>>Python>>正文


Python uuid.uuid3方法代碼示例

本文整理匯總了Python中uuid.uuid3方法的典型用法代碼示例。如果您正苦於以下問題:Python uuid.uuid3方法的具體用法?Python uuid.uuid3怎麽用?Python uuid.uuid3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在uuid的用法示例。


在下文中一共展示了uuid.uuid3方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def __init__(self, module, block, module_name, extra):
        self.module = module
        self.block = block
        self.module_name = module_name
        self._extra = extra

        method_block_index = self.get_code_block_index(self.block)
        if method_block_index is None:
            raise Exception('Block of code of a method from %s module was not found', self.module_name)

        self.name = self.block[method_block_index + 1].arg
        self._id = uuid3(UUID('{baa187e0-2c51-4ef6-aa42-b3421c22d5e1}'), self.full_name)
        self.start_line_no = self.block[method_block_index].lineno
        self.code_object = self.block[method_block_index].arg

#        dis.dis(code_object)
        self.code, self.dictionary_defs = preprocess_method_body(self.code_object)

        self.bytecode = Bytecode.from_code(self.code)

        self.evaluate_annotations(method_block_index)
        self.setup() 
開發者ID:CityOfZion,項目名稱:neo-boa,代碼行數:24,代碼來源:method.py

示例2: test_uuid3

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def test_uuid3(self):
        equal = self.assertEqual

        # Test some known version-3 UUIDs.
        for u, v in [(uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org'),
                      '6fa459ea-ee8a-3ca4-894e-db77e160355e'),
                     (uuid.uuid3(uuid.NAMESPACE_URL, 'http://python.org/'),
                      '9fe8e8c4-aaa8-32a9-a55c-4535a88b748d'),
                     (uuid.uuid3(uuid.NAMESPACE_OID, '1.3.6.1'),
                      'dd1a1cef-13d5-368a-ad82-eca71acd4cd1'),
                     (uuid.uuid3(uuid.NAMESPACE_X500, 'c=ca'),
                      '658d3002-db6b-3040-a1d1-8ddd7d189a4d'),
                    ]:
            equal(u.variant, uuid.RFC_4122)
            equal(u.version, 3)
            equal(u, uuid.UUID(v))
            equal(str(u), v) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:test_uuid.py

示例3: _fix

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def _fix(self):
        if self.uuid_template:
            return uuid.UUID(("%08x%04x%04x" + ("%02x" * 8))
                             % self.uuid_template)
        elif self.version == 1:
            return uuid.uuid1(self.node, self.clock_seq)
        elif self.version == 3:
            return uuid.uuid3(self.namespace, self.name)
        elif self.version == 4:
            return uuid.uuid4()
        elif self.version == 5:
            return uuid.uuid5(self.namespace, self.name)
        else:
            raise ValueError("Unhandled version")


# Automatic timestamp 
開發者ID:secdev,項目名稱:scapy,代碼行數:19,代碼來源:volatile.py

示例4: generate_uuid_from_subject

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def generate_uuid_from_subject(self, baseuuid, subject):
        uuidregx = re.compile(r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
        matches = uuidregx.search(str(subject))
        if matches:
            return matches.group(0)
        else:
            return str(uuid.uuid3(baseuuid, str(subject))) 
開發者ID:archesproject,項目名稱:arches,代碼行數:9,代碼來源:skos.py

示例5: _fabric_server_uuid

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def _fabric_server_uuid(host, port):
    """Create a UUID using host and port"""
    return uuid.uuid3(uuid.NAMESPACE_URL, _fabric_xmlrpc_uri(host, port)) 
開發者ID:LuciferJack,項目名稱:python-mysql-pool,代碼行數:5,代碼來源:connection.py

示例6: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def __init__(self, url):
        self.fullurl = self._complete_url(url)
        uinfo = urlparse.urlparse(self.fullurl)
        pext = os.path.splitext(uinfo.path)
        if len(pext) == 2 and pext[1] not in ('.cgi', '.sh'):
            warnings.warn("Recommended suffix CGI!")

        self.host = uinfo.hostname
        self.uuid = uuid.uuid3(uuid.NAMESPACE_DNS, 'hanchen.me').hex
        self.user = 'unknown'
        self._init_opener() 
開發者ID:cj1324,項目名稱:CGIShell,代碼行數:13,代碼來源:cgishell.py

示例7: get_uuid3

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def get_uuid3(str_in):
    """ make a UUID using an MD5 hash of a namespace UUID and a name
    @param str_in 輸入字符串
    """
    s = uuid.uuid3(uuid.NAMESPACE_DNS, str_in)
    return str(s) 
開發者ID:SimoHaiLiu,項目名稱:thenextquant,代碼行數:8,代碼來源:tools.py

示例8: get_uuid3

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def get_uuid3(str_in):
    """Generate a UUID using an MD5 hash of a namespace UUID and a name

    Args:
        str_in: Input string.

    Returns:
        s: UUID3 string.
    """
    uid3 = uuid.uuid3(uuid.NAMESPACE_DNS, str_in)
    s = str(uid3)
    return s 
開發者ID:JiaoziMatrix,項目名稱:aioquant,代碼行數:14,代碼來源:tools.py

示例9: generate_material_name

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def generate_material_name(shader_name, macros=None):
        if macros is not None and 0 < len(macros):
            keys = sorted(macros.keys())
            add_name = [key + "_" + str(macros[key]) for key in keys]
            shader_name += "_" + str(uuid.uuid3(uuid.NAMESPACE_DNS, "_".join(add_name))).replace("-", "_")
        return shader_name 
開發者ID:ubuntunux,項目名稱:PyEngine3D,代碼行數:8,代碼來源:ResourceManager.py

示例10: confuse_text

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def confuse_text(text):
        seeds = 'abcdefghijklmnopqrst'
        uid = str(uuid.uuid3(uuid.NAMESPACE_DNS, text))
        uid = "".join(uid.split('-'))
        result = ""
        for c in uid:
            try:
                num = int(c)
                result += seeds[num]
            except Exception as e:
                result += c
        return result.upper()

    # 生成混淆文件 
開發者ID:LennonChin,項目名稱:Code-Confuse-Plugin,代碼行數:16,代碼來源:Confuse.py

示例11: test_uuid_binary_3

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def test_uuid_binary_3(self):
        from uuid import uuid3, NAMESPACE_DNS
        uuid = uuid3(NAMESPACE_DNS, 'python.org')
        registry = self.init_registry(simple_column, ColumnType=UUID)
        test = registry.Test.insert(col=uuid)
        assert test.col is uuid 
開發者ID:AnyBlok,項目名稱:AnyBlok,代碼行數:8,代碼來源:test_column.py

示例12: test_uuid3_matches

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def test_uuid3_matches():
    for _ in range(100):
        uuid_format_validator(str(uuid.uuid3(uuid.uuid4(), 'test-4')))
        uuid_format_validator(str(uuid.uuid3(uuid.uuid1(), 'test-1'))) 
開發者ID:pipermerriam,項目名稱:flex,代碼行數:6,代碼來源:test_format_validators.py

示例13: id_from_name

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def id_from_name(name):
    """Generate a UUID using a name as the namespace

    :type name: str
    :rtype: str

    """
    return str(uuid.uuid3(uuid.NAMESPACE_DNS, name)).upper() 
開發者ID:repsac,項目名稱:io_three,代碼行數:10,代碼來源:utilities.py

示例14: create_uuid3

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def create_uuid3(namespace, name):
    """
    Return new UUID based on a hash of a UUID namespace and a string.
    :param namespace: The namespace
    :param name: The string
    :type namespace: uuid.UUID
    :type name: six.text
    :return:
    :rtype: uuid.UUID
    """
    return uuid.uuid3(namespace, six.ensure_str(name)) 
開發者ID:scalyr,項目名稱:scalyr-agent-2,代碼行數:13,代碼來源:util.py

示例15: generateUuid

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import uuid3 [as 別名]
def generateUuid(self, email_id, machine_name):
        """ return a uuid which uniquely identifies machinename and email id """
        uuidstr = None

        if machine_name not in self.d:
            myNamespace = uuid.uuid3(uuid.NAMESPACE_URL, machine_name)
            uuidstr = str(uuid.uuid3(myNamespace, email_id)) 

            self.d[machine_name] = (machine_name, uuidstr, email_id)
            self.d[uuidstr] = (machine_name, uuidstr ,email_id)
        else:
            (machine_name, uuidstr, email_id) = self.d[machine_name]

        return uuidstr 
開發者ID:ActiveState,項目名稱:code,代碼行數:16,代碼來源:recipe-501148.py


注:本文中的uuid.uuid3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。