本文整理匯總了Python中uuid.html方法的典型用法代碼示例。如果您正苦於以下問題:Python uuid.html方法的具體用法?Python uuid.html怎麽用?Python uuid.html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類uuid
的用法示例。
在下文中一共展示了uuid.html方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_extended_feature_class
# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import html [as 別名]
def get_extended_feature_class(self, uuid):
"""Getting the extended feature class from a UUID.
Args:
uuid (UUID): Characteristic's UUID.
Refer to
`UUID: <https://ianharvey.github.io/bluepy-doc/uuid.html>`_ for
more information.
Returns:
type: The feature's class if found, "None" otherwise.
"""
# Extracting the feature mask from the characteristic's UUID.
feature_mask = FeatureCharacteristic.extract_feature_mask(uuid)
# Returning the feature's class.
if feature_mask in FeatureCharacteristic.EXTENDED_MASK_TO_FEATURE_DIC:
return FeatureCharacteristic.EXTENDED_MASK_TO_FEATURE_DIC[
feature_mask]
return None
示例2: autogenerate_pk
# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import html [as 別名]
def autogenerate_pk(self):
"""
Autogenerates a primary key for this document. This function gets called by the backend
if you save a document without a primary key field. By default, it uses `uuid.uuid4().hex`
to generate a (statistically) unique primary key for the object (`more about UUIDs
<https://docs.python.org/2/library/uuid.html>`_).
If you want to define your own primary key generation mechanism, just redefine this function
in your document class.
"""
self.pk = uuid.uuid4().hex
示例3: get_uid
# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import html [as 別名]
def get_uid():
""":return The unique ID of this bot."""
# The bot must be connected to WiFi anyway, so getnode is fine.
# See https://docs.python.org/2/library/uuid.html#uuid.getnode
return hexlify(getpass.getuser() + "-" + str(uuid.getnode()) + "-" + __version__)
示例4: extract_feature_mask
# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import html [as 別名]
def extract_feature_mask(self, uuid):
""""Extract the fist 32 bits from the characteristic's UUID.
Args:
uuid (UUID): Characteristic's UUID.
Refer to
`UUID: <https://ianharvey.github.io/bluepy-doc/uuid.html>`_ for
more information.
Returns:
int: The first 32 bit of the characteristic's UUID.
"""
return int(str(uuid).split('-')[0], 16)