本文整理汇总了Python中cybox.common.PatternFieldGroup.to_dict方法的典型用法代码示例。如果您正苦于以下问题:Python PatternFieldGroup.to_dict方法的具体用法?Python PatternFieldGroup.to_dict怎么用?Python PatternFieldGroup.to_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.common.PatternFieldGroup
的用法示例。
在下文中一共展示了PatternFieldGroup.to_dict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import to_dict [as 别名]
def to_dict(self):
if self.is_plain():
return self.serialized_value
attr_dict = {}
if self.value is not None:
attr_dict['value'] = self.serialized_value
if self.datatype is not None and (self.datatype != self.default_datatype):
attr_dict['datatype'] = self.datatype
if self.id_ is not None:
attr_dict['id'] = self.id_
if self.idref is not None:
attr_dict['idref'] = self.idref
if self.appears_random is not None:
attr_dict['appears_random'] = self.appears_random
if self.is_obfuscated is not None:
attr_dict['is_obfuscated'] = self.is_obfuscated
if self.obfuscation_algorithm_ref is not None:
attr_dict['obfuscation_algorithm_ref'] = self.obfuscation_algorithm_ref
if self.is_defanged is not None:
attr_dict['is_defanged'] = self.is_defanged
if self.defanging_algorithm_ref is not None:
attr_dict['defanging_algorithm_ref'] = self.defanging_algorithm_ref
if self.refanging_transform_type is not None:
attr_dict['refanging_transform_type'] = self.refanging_transform_type
if self.refanging_transform is not None:
attr_dict['refanging_transform'] = self.refanging_transform
if self.observed_encoding is not None:
attr_dict['observed_encoding'] = self.observed_encoding
PatternFieldGroup.to_dict(self, attr_dict)
return attr_dict
示例2: to_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import to_dict [as 别名]
def to_dict(self):
if self.is_plain():
return self.serialized_value
attr_dict = {}
if self.value is not None:
attr_dict['value'] = self.serialized_value
# For now, don't output the datatype, as it is not required and is
# usually not needed, as it can be inferred from the context.
#if self.datatype is not None:
# attr_dict['datatype'] = self.datatype
if self.id_ is not None:
attr_dict['id'] = self.id_
if self.idref is not None:
attr_dict['idref'] = self.idref
if self.appears_random is not None:
attr_dict['appears_random'] = self.appears_random
if self.is_obfuscated is not None:
attr_dict['is_obfuscated'] = self.is_obfuscated
if self.obfuscation_algorithm_ref is not None:
attr_dict['obfuscation_algorithm_ref'] = self.obfuscation_algorithm_ref
if self.is_defanged is not None:
attr_dict['is_defanged'] = self.is_defanged
if self.defanging_algorithm_ref is not None:
attr_dict['defanging_algorithm_ref'] = self.defanging_algorithm_ref
if self.refanging_transform_type is not None:
attr_dict['refanging_transform_type'] = self.refanging_transform_type
if self.refanging_transform is not None:
attr_dict['refanging_transform'] = self.refanging_transform
PatternFieldGroup.to_dict(self, attr_dict)
return attr_dict
示例3: to_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import to_dict [as 别名]
def to_dict(self):
if self.is_plain():
return self.value
vocab_dict = {}
if self.value is not None:
vocab_dict['value'] = self.value
if self.xsi_type:
vocab_dict['xsi:type'] = self.xsi_type
if self.vocab_name is not None:
vocab_dict['vocab_name'] = self.vocab_name
if self.vocab_reference is not None:
vocab_dict['vocab_reference'] = self.vocab_reference
PatternFieldGroup.to_dict(self, vocab_dict)
return vocab_dict
示例4: to_dict
# 需要导入模块: from cybox.common import PatternFieldGroup [as 别名]
# 或者: from cybox.common.PatternFieldGroup import to_dict [as 别名]
def to_dict(self):
if not self.is_valid():
raise ValueError("Vocab being used has not been specified")
if self.is_plain():
return self.value
vocab_dict = {}
if self.value is not None:
vocab_dict['value'] = self.value
if self.xsi_type != self._XSI_TYPE:
vocab_dict['xsi:type'] = self.xsi_type
if self.vocab_name is not None:
vocab_dict['vocab_name'] = self.vocab_name
if self.vocab_reference is not None:
vocab_dict['vocab_reference'] = self.vocab_reference
PatternFieldGroup.to_dict(self, vocab_dict)
return vocab_dict