diff --git a/docs/conf.py b/docs/conf.py index afc2f68..dbed6a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,23 +57,30 @@ latex_documents = [ (master_doc, 'stix2.tex', 'stix2 Documentation', 'OASIS', 'manual'), ] + def get_property_type(prop): + """Convert property classname into pretty string name of property. + + """ try: prop_class = prop.__name__ except AttributeError: prop_class = prop.__class__.__name__ + # Remove 'Property' from the string prop_class = prop_class.split('Property')[0] + # Split camelcase with spaces split_camelcase = re.sub('(?!^)([A-Z][a-z]+)', r' \1', prop_class).split() prop_class = ' '.join(split_camelcase) return prop_class + class STIXAttributeDocumenter(ClassDocumenter): - '''Custom Sphinx extension to auto-document STIX properties. + """Custom Sphinx extension to auto-document STIX properties. Needed because descendants of _STIXBase use `_properties` dictionaries instead of instance variables for STIX 2 objects' properties. - ''' + """ objtype = 'stixattr' directivetype = 'class' priority = 999 @@ -100,5 +107,6 @@ class STIXAttributeDocumenter(ClassDocumenter): self.add_line(' - %s' % prop_str, '') self.add_line('', '') + def setup(app): app.add_autodocumenter(STIXAttributeDocumenter) diff --git a/stix2/v20/observables.py b/stix2/v20/observables.py index 1adde90..83600b0 100644 --- a/stix2/v20/observables.py +++ b/stix2/v20/observables.py @@ -76,7 +76,7 @@ class ExtensionsProperty(DictionaryProperty): class Artifact(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'artifact' _properties = OrderedDict() @@ -98,7 +98,7 @@ class Artifact(_Observable): class AutonomousSystem(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'autonomous-system' _properties = OrderedDict() @@ -114,7 +114,7 @@ class AutonomousSystem(_Observable): class Directory(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'directory' _properties = OrderedDict() @@ -134,7 +134,7 @@ class Directory(_Observable): class DomainName(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'domain-name' _properties = OrderedDict() @@ -149,7 +149,7 @@ class DomainName(_Observable): class EmailAddress(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'email-addr' _properties = OrderedDict() @@ -165,7 +165,7 @@ class EmailAddress(_Observable): class EmailMIMEComponent(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _properties = OrderedDict() _properties.update([ @@ -183,7 +183,7 @@ class EmailMIMEComponent(_STIXBase): class EmailMessage(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'email-message' _properties = OrderedDict() @@ -217,7 +217,7 @@ class EmailMessage(_Observable): class ArchiveExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'archive-ext' _properties = OrderedDict() @@ -231,7 +231,7 @@ class ArchiveExt(_Extension): class AlternateDataStream(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _properties = OrderedDict() _properties.update([ @@ -244,7 +244,7 @@ class AlternateDataStream(_STIXBase): class NTFSExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'ntfs-ext' _properties = OrderedDict() @@ -257,7 +257,7 @@ class NTFSExt(_Extension): class PDFExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'pdf-ext' _properties = OrderedDict() @@ -273,7 +273,7 @@ class PDFExt(_Extension): class RasterImageExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'raster-image-ext' _properties = OrderedDict() @@ -289,7 +289,7 @@ class RasterImageExt(_Extension): class WindowsPEOptionalHeaderType(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _properties = OrderedDict() _properties.update([ @@ -334,7 +334,7 @@ class WindowsPEOptionalHeaderType(_STIXBase): class WindowsPESection(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _properties = OrderedDict() _properties.update([ @@ -348,7 +348,7 @@ class WindowsPESection(_STIXBase): class WindowsPEBinaryExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'windows-pebinary-ext' _properties = OrderedDict() @@ -371,7 +371,7 @@ class WindowsPEBinaryExt(_Extension): class File(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'file' _properties = OrderedDict() @@ -405,7 +405,7 @@ class File(_Observable): class IPv4Address(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'ipv4-addr' _properties = OrderedDict() @@ -421,7 +421,7 @@ class IPv4Address(_Observable): class IPv6Address(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'ipv6-addr' _properties = OrderedDict() @@ -437,7 +437,7 @@ class IPv6Address(_Observable): class MACAddress(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'mac-addr' _properties = OrderedDict() @@ -451,7 +451,7 @@ class MACAddress(_Observable): class Mutex(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'mutex' _properties = OrderedDict() @@ -465,7 +465,7 @@ class Mutex(_Observable): class HTTPRequestExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'http-request-ext' _properties = OrderedDict() @@ -482,7 +482,7 @@ class HTTPRequestExt(_Extension): class ICMPExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'icmp-ext' _properties = OrderedDict() @@ -495,7 +495,7 @@ class ICMPExt(_Extension): class SocketExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'socket-ext' _properties = OrderedDict() @@ -536,7 +536,7 @@ class SocketExt(_Extension): class TCPExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'tcp-ext' _properties = OrderedDict() @@ -549,7 +549,7 @@ class TCPExt(_Extension): class NetworkTraffic(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'network-traffic' _properties = OrderedDict() @@ -583,7 +583,7 @@ class NetworkTraffic(_Observable): class WindowsProcessExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'windows-process-ext' _properties = OrderedDict() @@ -600,7 +600,7 @@ class WindowsProcessExt(_Extension): class WindowsServiceExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'windows-service-ext' _properties = OrderedDict() @@ -638,7 +638,7 @@ class WindowsServiceExt(_Extension): class Process(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'process' _properties = OrderedDict() @@ -679,7 +679,7 @@ class Process(_Observable): class Software(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'software' _properties = OrderedDict() @@ -697,7 +697,7 @@ class Software(_Observable): class URL(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'url' _properties = OrderedDict() @@ -711,7 +711,7 @@ class URL(_Observable): class UNIXAccountExt(_Extension): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'unix-account-ext' _properties = OrderedDict() @@ -726,7 +726,7 @@ class UNIXAccountExt(_Extension): class UserAccount(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'user-account' _properties = OrderedDict() @@ -752,7 +752,7 @@ class UserAccount(_Observable): class WindowsRegistryValueType(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'windows-registry-value-type' _properties = OrderedDict() @@ -780,7 +780,7 @@ class WindowsRegistryValueType(_STIXBase): class WindowsRegistryKey(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'windows-registry-key' _properties = OrderedDict() @@ -804,7 +804,7 @@ class WindowsRegistryKey(_Observable): class X509V3ExtenstionsType(_STIXBase): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'x509-v3-extensions-type' _properties = OrderedDict() @@ -831,7 +831,7 @@ class X509V3ExtenstionsType(_STIXBase): class X509Certificate(_Observable): """For more detailed information on this object's properties, see `the STIX 2.0 specification `__. - """ + """ # noqa _type = 'x509-certificate' _properties = OrderedDict()