本文整理汇总了Python中pyasn1.type.univ.Set方法的典型用法代码示例。如果您正苦于以下问题:Python univ.Set方法的具体用法?Python univ.Set怎么用?Python univ.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasn1.type.univ
的用法示例。
在下文中一共展示了univ.Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setXmlAttribute
# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Set [as 别名]
def _setXmlAttribute(node, key, value):
"""
Set an XML attribute with handling for UnicodeDecodeError.
"""
try:
node.set(key, str(value))
value = str(node.get(key))
except UnicodeEncodeError:
node.set("%s-Encoded" % key, "base64")
node.set(key, base64.b64encode(str(value)))
except UnicodeDecodeError:
node.set("%s-Encoded" % key, "base64")
node.set(key, base64.b64encode(str(value)))
示例2: _setAttribute
# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Set [as 别名]
def _setAttribute(self, node, name, value, default = None):
"""
Set an attribute on an XML Element. We only set the
attribute in the following cases:
1. We have no attached xml node or self.ref == None
2. We have a node, and the node has that attribute
3. The value is not None
"""
# Simplify the XML by not adding defaults
if value == default or value is None:
return
node.set(name, str(value))
示例3: setDefaultValue
# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Set [as 别名]
def setDefaultValue(self, value):
"""
Set the default value for this data element.
"""
self.defaultValue = value
示例4: setValue
# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Set [as 别名]
def setValue(self, value):
"""
Set the current value for this data element
"""
self.currentValue = value
self.getValue()