本文整理汇总了Python中cybox.common.PatternFieldGroup.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python PatternFieldGroup.from_dict方法的具体用法?Python PatternFieldGroup.from_dict怎么用?Python PatternFieldGroup.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.common.PatternFieldGroup
的用法示例。
在下文中一共展示了PatternFieldGroup.from_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _populate_from_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import from_dict [as 别名]
def _populate_from_dict(self, attr_dict):
# If this attribute is "plain", use it as the value and assume the
# datatype was set correctly by the constructor of the particular
# BaseProperty Subclass.
if not isinstance(attr_dict, dict):
self.value = attr_dict
else:
# This key should always be present
self.value = attr_dict.get('value')
# This defaults to False if missing
self._force_datatype = attr_dict.get('force_datatype', False)
# 'None' is fine if these keys are missing
self.id_ = attr_dict.get('id')
self.idref = attr_dict.get('idref')
self.appears_random = attr_dict.get('appears_random')
self.datatype = attr_dict.get('datatype')
self.is_obfuscated = attr_dict.get('is_obfuscated')
self.obfuscation_algorithm_ref = attr_dict.get('obfuscation_algorithm_ref')
self.is_defanged = attr_dict.get('is_defanged')
self.defanging_algorithm_ref = attr_dict.get('defanging_algorithm_ref')
self.refanging_transform_type = attr_dict.get('refanging_transform_type')
self.refanging_transform = attr_dict.get('refanging_transform')
self.observed_encoding = attr_dict.get('observed_encoding')
PatternFieldGroup.from_dict(attr_dict, self)
示例2: from_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import from_dict [as 别名]
def from_dict(cls, vocab_dict):
if not vocab_dict:
return None
vocab_str = cls()
# xsi_type should be set automatically by the class's constructor.
# In case this is a "plain" string, just set it.
if not isinstance(vocab_dict, dict):
vocab_str.value = vocab_dict
else:
vocab_str.xsi_type = vocab_dict.get('xsi:type', cls._XSI_TYPE)
vocab_str.value = vocab_dict.get('value')
vocab_str.vocab_name = vocab_dict.get('vocab_name')
vocab_str.vocab_reference = vocab_dict.get('vocab_reference')
PatternFieldGroup.from_dict(vocab_dict, vocab_str)
return vocab_str
示例3: from_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import from_dict [as 别名]
def from_dict(cls, vocab_dict, return_obj=None):
if not vocab_dict:
return None
if not return_obj:
if isinstance(vocab_dict, dict):
klass = VocabString.lookup_class(vocab_dict.get('xsi:type'))
return_obj = klass()
else:
return_obj = cls()
# In case this is a "plain" string, just set it.
if not isinstance(vocab_dict, dict):
return_obj.value = vocab_dict
else:
return_obj.xsi_type = vocab_dict.get('xsi:type', cls._XSI_TYPE)
return_obj.value = vocab_dict.get('value')
return_obj.vocab_name = vocab_dict.get('vocab_name')
return_obj.vocab_reference = vocab_dict.get('vocab_reference')
PatternFieldGroup.from_dict(vocab_dict, return_obj)
return return_obj