当前位置: 首页>>代码示例>>Python>>正文


Python PatternFieldGroup.from_dict方法代码示例

本文整理汇总了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)
开发者ID:pfinn1977,项目名称:python-cybox,代码行数:29,代码来源:properties.py

示例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
开发者ID:luisgf,项目名称:watsondt,代码行数:21,代码来源:vocabs.py

示例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
开发者ID:aravindpfpt,项目名称:python-cybox,代码行数:25,代码来源:vocabs.py


注:本文中的cybox.common.PatternFieldGroup.from_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。