| 19 | |
| 20 | |
| 21 | class Identity(stix.Entity): |
| 22 | _binding = common_binding |
| 23 | _binding_class = IdentityType |
| 24 | _namespace = 'http://docs.oasis-open.org/cti/ns/stix/common-1' |
| 25 | |
| 26 | id_ = fields.IdField("id") |
| 27 | idref = fields.IdrefField("idref") |
| 28 | name = fields.TypedField("Name") |
| 29 | related_identities = fields.TypedField("Related_Identities", type_="stix.common.identity.RelatedIdentities") |
| 30 | |
| 31 | def __init__(self, id_=None, idref=None, name=None, related_identities=None): |
| 32 | super(Identity, self).__init__() |
| 33 | |
| 34 | self.id_ = id_ |
| 35 | self.idref = idref |
| 36 | self.name = name |
| 37 | self.related_identities = related_identities |
| 38 | |
| 39 | def to_dict(self): |
| 40 | d = super(Identity, self).to_dict() |
| 41 | |
| 42 | if self._XSI_TYPE: |
| 43 | d['xsi:type'] = self._XSI_TYPE |
| 44 | |
| 45 | return d |
| 46 | |
| 47 | @staticmethod |
| 48 | def lookup_class(xsi_type): |
| 49 | return stix.lookup_extension(xsi_type, default=Identity) |
| 50 | |
| 51 | # We can't import RelatedIdentity until we have defined the Identity class. |
| 52 | from stix.common.related import RelatedIdentity |
no outgoing calls
no test coverage detected