stidantic 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stidantic
3
- Version: 0.1.0
4
- Summary: A Pydantic-based Python library for parsing, validating, and creating STIX 2.1 cyber threat intelligence data
3
+ Version: 0.2.0
4
+ Summary: A Pydantic-based Python library for parsing, validating, and creating STIX 2.1 cyber threat intelligence data.
5
5
  Project-URL: Homepage, https://github.com/nicocti/stidantic
6
- Project-URL: Repository, https://github.com/nicocti/stidantic
7
- Project-URL: Issues, https://github.com/nicocti/stidantic/issues
8
- Project-URL: Documentation, https://github.com/nicocti/stidantic#readme
9
- Author-email: nicocti <your.email@example.com>
10
- Maintainer-email: nicocti <your.email@example.com>
11
- License: MIT
6
+ Project-URL: Bug Tracker, https://github.com/nicocti/stidantic/issues
7
+ Author-email: nicocti <nicocti@users.noreply.github.com>
8
+ Maintainer-email: nicocti <nicocti@users.noreply.github.com>
12
9
  License-File: LICENSE
13
10
  Keywords: cti,pydantic,stix,stix2,stix2.1
14
11
  Classifier: Development Status :: 3 - Alpha
@@ -23,17 +20,24 @@ Classifier: Topic :: Security
23
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
21
  Classifier: Typing :: Typed
25
22
  Requires-Python: >=3.12
23
+ Requires-Dist: annotated-types>=0.6.0
26
24
  Requires-Dist: pydantic>=2.12
25
+ Requires-Dist: typing-extensions>=4.14.1
26
+ Provides-Extra: dev
27
+ Requires-Dist: basedpyright; extra == 'dev'
28
+ Provides-Extra: test
29
+ Requires-Dist: deepdiff; extra == 'test'
27
30
  Description-Content-Type: text/markdown
28
31
 
29
32
  # stidantic [WIP]
30
33
 
31
- **This is work in progress, not compliant yet.**
34
+ **This is work in progress, compliant but untested.**
32
35
 
33
36
  A Pydantic-based Python library for parsing, validating, and creating STIX 2.1 cyber threat intelligence data.
34
37
 
35
38
  [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
36
39
  [![Pydantic v2](https://img.shields.io/badge/pydantic-v2.12+-green.svg)](https://docs.pydantic.dev/)
40
+ [![STIX v2.1](https://img.shields.io/badge/stix-v2.1+-red.svg)](https://oasis-open.github.io/cti-documentation/stix/intro)
37
41
 
38
42
  ## Overview
39
43
 
@@ -53,7 +57,7 @@ This library leverages [Pydantic](https://docs.pydantic.dev/) to provide:
53
57
  ### Requirements
54
58
 
55
59
  - Python 3.12 or later (uses PEP 695 type statements)
56
- - Pydantic > 2.10
60
+ - Pydantic >= 2.12
57
61
 
58
62
  ## Quick Start
59
63
 
@@ -80,7 +84,6 @@ from stidantic.sdo import Campaign
80
84
  from stidantic.types import Identifier
81
85
 
82
86
  campaign = Campaign(
83
- id=Identifier("campaign--8e2e2d2b-17d4-4cbf-938f-98ee46b3cd3f"),
84
87
  created=datetime.now(),
85
88
  modified=datetime.now(),
86
89
  name="Operation Stealth",
@@ -93,48 +96,71 @@ json_output = campaign.model_dump_json(indent=2, exclude_none=True, by_alias=Tru
93
96
  print(json_output)
94
97
  ```
95
98
 
99
+ ### Handling property extensions
100
+
101
+ ```python
102
+ from stidantic.marking import MarkingDefinition
103
+ from stidantic.extensions.pap import PAPExtensionDefinition, PAPExtension
104
+
105
+ MarkingDefinition.register_new_extension(PAPExtensionDefinition, PAPExtension)
106
+ data = {
107
+ "extensions": {
108
+ "extension-definition--f8d78575-edfd-406e-8e84-6162a8450f5b": {
109
+ "extension_type": "property-extension",
110
+ "pap": "green",
111
+ }
112
+ },
113
+ "created": "2022-10-01T00:00:00Z",
114
+ "name": "PAP:GREEN",
115
+ }
116
+
117
+ pap_green = MarkingDefinition.model_validate(data)
118
+ if isinstance(pap_green.extensions[PAPExtensionDefinition.id], PAPExtension):
119
+ print("Extension was parsed & validated by Pydantic.")
120
+ ```
121
+
96
122
  ## Implemented STIX Objects
97
123
 
98
124
  ### STIX Domain Objects (SDOs)
99
125
  - ✅ `AttackPattern` - Ways adversaries attempt to compromise targets
100
126
  - ✅ `Campaign` - Grouping of adversarial behaviors over time
101
- - 🚧 `Course of Action` - Action taken to prevent or respond to an attack
102
- - 🚧 `Grouping` - Explicitly asserts that STIX Objects have a shared context
103
- - 🚧 `Identity` - Actual individuals, organizations, or groups
104
- - 🚧 `Incident` - A stub object representing a security incident
105
- - 🚧 `Indicator` - Pattern that can be used to detect suspicious or malicious activity
106
- - 🚧 `Infrastructure` - Systems, software services, and associated resources
107
- - 🚧 `Intrusion Set` - A grouped set of adversarial behaviors and resources
108
- - 🚧 `Location` - A geographic location
109
- - 🚧 `Malware` - A type of TTP that represents malicious code
110
- - 🚧 `Malware Analysis` - The results of a malware analysis
111
- - 🚧 `Note` - Analyst-created content and context
112
- - 🚧 `Observed Data` - Information about cyber security related entities
113
- - 🚧 `Opinion` - An assessment of the correctness of a STIX Object
114
- - 🚧 `Report` - Collections of threat intelligence
115
- - 🚧 `Threat Actor` - Actual individuals, groups, or organizations
116
- - 🚧 `Tool` - Legitimate software that can be used by threat actors
117
- - 🚧 `Vulnerability` - A mistake in software that can be used to compromise a system
127
+ - `Course of Action` - Action taken to prevent or respond to an attack
128
+ - `Grouping` - Explicitly asserts that STIX Objects have a shared context
129
+ - `Identity` - Actual individuals, organizations, or groups
130
+ - `Incident` - A stub object representing a security incident
131
+ - `Indicator` - Pattern that can be used to detect suspicious or malicious activity
132
+ - `Infrastructure` - Systems, software services, and associated resources
133
+ - `Intrusion Set` - A grouped set of adversarial behaviors and resources
134
+ - `Location` - A geographic location
135
+ - `Malware` - A type of TTP that represents malicious code
136
+ - `Malware Analysis` - The results of a malware analysis
137
+ - `Note` - Analyst-created content and context
138
+ - `Observed Data` - Information about cyber security related entities
139
+ - `Opinion` - An assessment of the correctness of a STIX Object
140
+ - `Report` - Collections of threat intelligence
141
+ - `Threat Actor` - Actual individuals, groups, or organizations
142
+ - `Tool` - Legitimate software that can be used by threat actors
143
+ - `Vulnerability` - A mistake in software that can be used to compromise a system
118
144
 
119
145
  ### STIX Cyber-observable Objects (SCOs)
120
146
  - ✅ `Artifact` - Binary or file-like objects
121
147
  - ✅ `AutonomousSystem` - Autonomous System (AS) information
122
- - 🚧 `Directory` - A directory on a file system
123
- - 🚧 `Domain Name` - A network domain name
124
- - 🚧 `Email Address` - An email address
125
- - 🚧 `Email Message` - An email message
126
- - 🚧 `File` - A computer file
127
- - 🚧 `IPv4 Address` - An IPv4 address
128
- - 🚧 `IPv6 Address` - An IPv6 address
129
- - 🚧 `MAC Address` - A Media Access Control (MAC) address
130
- - 🚧 `Mutex` - A mutual exclusion object
131
- - 🚧 `Network Traffic` - A network traffic flow
132
- - 🚧 `Process` - A running process
133
- - 🚧 `Software` - A software product
134
- - 🚧 `URL` - A Uniform Resource Locator (URL)
135
- - 🚧 `User Account` - A user account on a system
136
- - 🚧 `Windows Registry Key` - A key in the Windows registry
137
- - 🚧 `X.509 Certificate` - An X.509 certificate
148
+ - `Directory` - A directory on a file system
149
+ - `Domain Name` - A network domain name
150
+ - `Email Address` - An email address
151
+ - `Email Message` - An email message
152
+ - `File` - A computer file
153
+ - `IPv4 Address` - An IPv4 address
154
+ - `IPv6 Address` - An IPv6 address
155
+ - `MAC Address` - A Media Access Control (MAC) address
156
+ - `Mutex` - A mutual exclusion object
157
+ - `Network Traffic` - A network traffic flow
158
+ - `Process` - A running process
159
+ - `Software` - A software product
160
+ - `URL` - A Uniform Resource Locator (URL)
161
+ - `User Account` - A user account on a system
162
+ - `Windows Registry Key` - A key in the Windows registry
163
+ - `X.509 Certificate` - An X.509 certificate
138
164
 
139
165
  ### STIX Relationship Objects (SROs)
140
166
  - ✅ `Relationship` - Connections between STIX objects
@@ -148,14 +174,21 @@ print(json_output)
148
174
  ### Bundle
149
175
  - ✅ `StixBundle` - Container for STIX objects
150
176
 
177
+ ### Extensions
178
+ - ✅ `PAP` - Permissible Actions Protocol (PAP) extension from [Oasis](https://github.com/oasis-open/cti-stix-common-objects/blob/main/extension-definition-specifications/pap-marking-definition-f8d/STIX-2.1-PAP-marking-definition.adoc)
179
+
151
180
  ## Roadmap
152
181
 
153
- - **Full STIX 2.1 Compliance**
154
- - **Python packaging**
182
+ - ~~**Full STIX 2.1 Compliance**~~
183
+ - ~~**Python packaging**~~
155
184
  - **Extensive Testing**
185
+ - ~~Mind the datetime datatype serializer to follow the specification (convert to UTC).~~
186
+ - ~~Implement auto deterministic UUIv5 generation for STIX Identifiers.~~
187
+ - Implement a Indicator to Observable export method (and the other way round ?).
188
+ - Add Generics validation for Identifier properties that must be of some type.
156
189
  - Better STIX Extension Support: Develop a robust and user-friendly mechanism for defining, parsing, and validating custom STIX extensions.
157
190
  - TAXII 2.1 Server: Build a TAXII 2.1 compliant server using FastAPI.
158
- - OCA Standard Extensions: Implement STIX extensions from the [Open Cybersecurity Alliance (OCA)](https://github.com/opencybersecurityalliance/stix-extensions) repository.
191
+ - OCA Standard Extensions: Implement STIX extensions from the [Open Cybersecurity Alliance (OCA)](https://github.com/opencybersecurityalliance/stix-extensions) and [stix-common-objects](https://github.com/oasis-open/cti-stix-common-objects) repositories.
159
192
  - Performance Tuning: Profile and optimize parsing and serialization.
160
193
 
161
194
  ## Resources
@@ -170,4 +203,4 @@ stidantic is released under the [MIT License](https://opensource.org/licenses/MI
170
203
 
171
204
  ## Acknowledgments
172
205
 
173
- This project implements the STIX 2.1 specification published by the OASIS Cyber Threat Intelligence (CTI) Technical Committee.
206
+ This project implements the STIX 2.1 specification edited by Bret Jordan, Rich Piazza, and Trey Darley, published by the OASIS Cyber Threat Intelligence (CTI) Technical Committee.
@@ -0,0 +1,175 @@
1
+ # stidantic [WIP]
2
+
3
+ **This is work in progress, compliant but untested.**
4
+
5
+ A Pydantic-based Python library for parsing, validating, and creating STIX 2.1 cyber threat intelligence data.
6
+
7
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
8
+ [![Pydantic v2](https://img.shields.io/badge/pydantic-v2.12+-green.svg)](https://docs.pydantic.dev/)
9
+ [![STIX v2.1](https://img.shields.io/badge/stix-v2.1+-red.svg)](https://oasis-open.github.io/cti-documentation/stix/intro)
10
+
11
+ ## Overview
12
+
13
+ **stidantic** provides a type-safe, Pythonic way to work with [STIX 2.1](https://oasis-open.github.io/cti-documentation/stix/intro) (Structured Threat Information Expression) objects.
14
+
15
+ This library leverages [Pydantic](https://docs.pydantic.dev/) to provide:
16
+
17
+ - 🔒 **Strong type validation** for all STIX objects
18
+ - 📝 **IDE auto-completion** and type hints
19
+ - ✅ **Automatic validation** of STIX specification constraints
20
+ - 🔄 **Easy JSON serialization/deserialization**
21
+ - ❄️ **Immutable models** with frozen Pydantic configurations
22
+ - 🎯 **Discriminated unions** for polymorphic STIX object handling
23
+
24
+ ## Installation
25
+
26
+ ### Requirements
27
+
28
+ - Python 3.12 or later (uses PEP 695 type statements)
29
+ - Pydantic >= 2.12
30
+
31
+ ## Quick Start
32
+
33
+ ### Parsing a STIX Bundle
34
+
35
+ ```python
36
+ from stidantic.bundle import StixBundle
37
+
38
+ # Load from JSON file
39
+ with open("threat_data.json", "r") as f:
40
+ bundle = StixBundle.model_validate_json(f.read())
41
+
42
+ # Access objects
43
+ print(f"Bundle contains {len(bundle.objects)} objects")
44
+ for obj in bundle.objects:
45
+ print(f"- {obj.type}: {obj.id}")
46
+ ```
47
+
48
+ ### Creating STIX Objects
49
+
50
+ ```python
51
+ from datetime import datetime
52
+ from stidantic.sdo import Campaign
53
+ from stidantic.types import Identifier
54
+
55
+ campaign = Campaign(
56
+ created=datetime.now(),
57
+ modified=datetime.now(),
58
+ name="Operation Stealth",
59
+ description="A sophisticated campaign targeting financial institutions",
60
+ objective="Financial gain through wire fraud"
61
+ )
62
+
63
+ # Export to JSON
64
+ json_output = campaign.model_dump_json(indent=2, exclude_none=True, by_alias=True)
65
+ print(json_output)
66
+ ```
67
+
68
+ ### Handling property extensions
69
+
70
+ ```python
71
+ from stidantic.marking import MarkingDefinition
72
+ from stidantic.extensions.pap import PAPExtensionDefinition, PAPExtension
73
+
74
+ MarkingDefinition.register_new_extension(PAPExtensionDefinition, PAPExtension)
75
+ data = {
76
+ "extensions": {
77
+ "extension-definition--f8d78575-edfd-406e-8e84-6162a8450f5b": {
78
+ "extension_type": "property-extension",
79
+ "pap": "green",
80
+ }
81
+ },
82
+ "created": "2022-10-01T00:00:00Z",
83
+ "name": "PAP:GREEN",
84
+ }
85
+
86
+ pap_green = MarkingDefinition.model_validate(data)
87
+ if isinstance(pap_green.extensions[PAPExtensionDefinition.id], PAPExtension):
88
+ print("Extension was parsed & validated by Pydantic.")
89
+ ```
90
+
91
+ ## Implemented STIX Objects
92
+
93
+ ### STIX Domain Objects (SDOs)
94
+ - ✅ `AttackPattern` - Ways adversaries attempt to compromise targets
95
+ - ✅ `Campaign` - Grouping of adversarial behaviors over time
96
+ - ✅ `Course of Action` - Action taken to prevent or respond to an attack
97
+ - ✅ `Grouping` - Explicitly asserts that STIX Objects have a shared context
98
+ - ✅ `Identity` - Actual individuals, organizations, or groups
99
+ - ✅ `Incident` - A stub object representing a security incident
100
+ - ✅ `Indicator` - Pattern that can be used to detect suspicious or malicious activity
101
+ - ✅ `Infrastructure` - Systems, software services, and associated resources
102
+ - ✅ `Intrusion Set` - A grouped set of adversarial behaviors and resources
103
+ - ✅ `Location` - A geographic location
104
+ - ✅ `Malware` - A type of TTP that represents malicious code
105
+ - ✅ `Malware Analysis` - The results of a malware analysis
106
+ - ✅ `Note` - Analyst-created content and context
107
+ - ✅ `Observed Data` - Information about cyber security related entities
108
+ - ✅ `Opinion` - An assessment of the correctness of a STIX Object
109
+ - ✅ `Report` - Collections of threat intelligence
110
+ - ✅ `Threat Actor` - Actual individuals, groups, or organizations
111
+ - ✅ `Tool` - Legitimate software that can be used by threat actors
112
+ - ✅ `Vulnerability` - A mistake in software that can be used to compromise a system
113
+
114
+ ### STIX Cyber-observable Objects (SCOs)
115
+ - ✅ `Artifact` - Binary or file-like objects
116
+ - ✅ `AutonomousSystem` - Autonomous System (AS) information
117
+ - ✅ `Directory` - A directory on a file system
118
+ - ✅ `Domain Name` - A network domain name
119
+ - ✅ `Email Address` - An email address
120
+ - ✅ `Email Message` - An email message
121
+ - ✅ `File` - A computer file
122
+ - ✅ `IPv4 Address` - An IPv4 address
123
+ - ✅ `IPv6 Address` - An IPv6 address
124
+ - ✅ `MAC Address` - A Media Access Control (MAC) address
125
+ - ✅ `Mutex` - A mutual exclusion object
126
+ - ✅ `Network Traffic` - A network traffic flow
127
+ - ✅ `Process` - A running process
128
+ - ✅ `Software` - A software product
129
+ - ✅ `URL` - A Uniform Resource Locator (URL)
130
+ - ✅ `User Account` - A user account on a system
131
+ - ✅ `Windows Registry Key` - A key in the Windows registry
132
+ - ✅ `X.509 Certificate` - An X.509 certificate
133
+
134
+ ### STIX Relationship Objects (SROs)
135
+ - ✅ `Relationship` - Connections between STIX objects
136
+ - ✅ `Sighting` - Observations of threat intelligence in the wild
137
+
138
+ ### Meta Objects
139
+ - ✅ `MarkingDefinition` - Data markings (includes TLP)
140
+ - ✅ `LanguageContent` - Translations and internationalization
141
+ - ✅ `ExtensionDefinition` - Custom STIX extensions
142
+
143
+ ### Bundle
144
+ - ✅ `StixBundle` - Container for STIX objects
145
+
146
+ ### Extensions
147
+ - ✅ `PAP` - Permissible Actions Protocol (PAP) extension from [Oasis](https://github.com/oasis-open/cti-stix-common-objects/blob/main/extension-definition-specifications/pap-marking-definition-f8d/STIX-2.1-PAP-marking-definition.adoc)
148
+
149
+ ## Roadmap
150
+
151
+ - ~~**Full STIX 2.1 Compliance**~~
152
+ - ~~**Python packaging**~~
153
+ - **Extensive Testing**
154
+ - ~~Mind the datetime datatype serializer to follow the specification (convert to UTC).~~
155
+ - ~~Implement auto deterministic UUIv5 generation for STIX Identifiers.~~
156
+ - Implement a Indicator to Observable export method (and the other way round ?).
157
+ - Add Generics validation for Identifier properties that must be of some type.
158
+ - Better STIX Extension Support: Develop a robust and user-friendly mechanism for defining, parsing, and validating custom STIX extensions.
159
+ - TAXII 2.1 Server: Build a TAXII 2.1 compliant server using FastAPI.
160
+ - OCA Standard Extensions: Implement STIX extensions from the [Open Cybersecurity Alliance (OCA)](https://github.com/opencybersecurityalliance/stix-extensions) and [stix-common-objects](https://github.com/oasis-open/cti-stix-common-objects) repositories.
161
+ - Performance Tuning: Profile and optimize parsing and serialization.
162
+
163
+ ## Resources
164
+
165
+ - [STIX 2.1 Specification](https://docs.oasis-open.org/cti/stix/v2.1/stix-v2.1.html)
166
+ - [STIX 2.1 Introduction](https://oasis-open.github.io/cti-documentation/stix/intro)
167
+ - [Pydantic Documentation](https://docs.pydantic.dev/)
168
+
169
+ ## License
170
+
171
+ stidantic is released under the [MIT License](https://opensource.org/licenses/MIT).
172
+
173
+ ## Acknowledgments
174
+
175
+ This project implements the STIX 2.1 specification edited by Bret Jordan, Rich Piazza, and Trey Darley, published by the OASIS Cyber Threat Intelligence (CTI) Technical Committee.
@@ -0,0 +1,208 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ dynamic = ["version"]
7
+ name = "stidantic"
8
+ authors = [
9
+ { name="nicocti", email="nicocti@users.noreply.github.com" },
10
+ ]
11
+ maintainers = [
12
+ { name="nicocti", email="nicocti@users.noreply.github.com" },
13
+ ]
14
+ description = "A Pydantic-based Python library for parsing, validating, and creating STIX 2.1 cyber threat intelligence data."
15
+ readme = "README.md"
16
+ requires-python = ">=3.12"
17
+ dependencies = [
18
+ "pydantic>=2.12",
19
+ "annotated-types>=0.6.0",
20
+ "typing-extensions>=4.14.1",
21
+ ]
22
+ keywords = [
23
+ "stix",
24
+ "stix2",
25
+ "stix2.1",
26
+ "cti",
27
+ "pydantic",
28
+ ]
29
+ classifiers = [
30
+ "Development Status :: 3 - Alpha",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Typing :: Typed",
35
+ "Operating System :: OS Independent",
36
+ "License :: OSI Approved :: MIT License",
37
+ "Intended Audience :: Developers",
38
+ "Intended Audience :: Information Technology",
39
+ "Topic :: Security",
40
+ "Topic :: Software Development :: Libraries :: Python Modules",
41
+ ]
42
+ licence = "MIT"
43
+ license-files = ["LICENSE"]
44
+
45
+ [project.optional-dependencies]
46
+ dev = ["basedpyright"]
47
+ test = ["deepdiff"]
48
+
49
+ [project.urls]
50
+ "Homepage" = "https://github.com/nicocti/stidantic"
51
+ "Bug Tracker" = "https://github.com/nicocti/stidantic/issues"
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["stidantic"]
55
+
56
+ [tool.hatch.version]
57
+ path = "VERSION"
58
+ pattern = "(?P<version>[^']+)"
59
+
60
+ [tool.hatch.build.targets.sdist]
61
+ include = [
62
+ "/stidantic",
63
+ "/README.md",
64
+ "/LICENSE",
65
+ ]
66
+
67
+ [tool.pyright]
68
+ strict = ["stidantic/"]
69
+
70
+ [tool.ruff]
71
+ line-length = 120
72
+ indent-width = 4
73
+
74
+ [tool.ruff.format]
75
+ docstring-code-format = true
76
+ indent-style = "space"
77
+ line-ending = "lf"
78
+ quote-style = "double"
79
+
80
+
81
+ [tool.ruff.lint]
82
+ ignore = [
83
+ "TRY003", # Avoid specifying long messages outside the exception class
84
+ "RUF003", # ambiguous-unicode-character-comment
85
+ "RUF012", # mutable-class-default
86
+ ]
87
+ select = [
88
+ # Pylint
89
+ "PLE", "PLW", "PLR", "PLC",
90
+ # pycodestyle
91
+ "E", "W",
92
+ # isort
93
+ "I",
94
+ # Pyflakes
95
+ "F",
96
+ # flake8-bugbear
97
+ "B",
98
+ # flake8-bandit
99
+ "S",
100
+ # pyupgrade
101
+ "UP",
102
+ # flake8-simplify
103
+ "SIM",
104
+ # flake8-annotations
105
+ "ANN",
106
+ # flake8-async
107
+ "ASYNC",
108
+ # flake8-blind-except
109
+ "BLE",
110
+ # flake8-boolean-trap
111
+ "FBT",
112
+ # flake8-builtins
113
+ "A",
114
+ # flake8-comprehensions
115
+ "C4",
116
+ # flake8-datetimez
117
+ "DTZ",
118
+ # flake8-debugger
119
+ "T10",
120
+ # flake8-gettext
121
+ "INT",
122
+ # flake8-implicit-str-concat
123
+ "ISC",
124
+ # flake8-logging
125
+ "LOG",
126
+ # flake8-logging-format
127
+ "G",
128
+ # flake8-no-pep420
129
+ "INP",
130
+ # flake8-pie
131
+ "PIE",
132
+ # flake8-print
133
+ "T20",
134
+ # flake8-quotes
135
+ "Q",
136
+ # flake8-raise
137
+ "RSE",
138
+ # flake8-return
139
+ "RET",
140
+ # flake8-self
141
+ "SLF",
142
+ # flake8-slots
143
+ "SLOT",
144
+ # flake8-tidy-imports
145
+ "TID",
146
+ # flake8-type-checking
147
+ "TC",
148
+ # flake8-unused-arguments
149
+ "ARG",
150
+ # flake8-use-pathlib
151
+ "PTH",
152
+ # flynt
153
+ "FLY",
154
+ # pep8-naming
155
+ "N",
156
+ # Perflint
157
+ "PERF",
158
+ # Pyflakes
159
+ "F",
160
+ # pygrep-hooks
161
+ "PGH",
162
+ # refurb
163
+ "FURB",
164
+ # Ruff-specific rules
165
+ "RUF",
166
+ # tryceratops
167
+ "TRY",
168
+ # eradicate
169
+ "ERA",
170
+ # pydoclint
171
+ # "DOC",
172
+ # pydocstyle
173
+ # "D",
174
+ # airflow
175
+ # "AIR",
176
+ # fastapi
177
+ # "FAST",
178
+ # flake8-2020
179
+ # "YTT",
180
+ # flake8-commas
181
+ # "COM",
182
+ # flake8-copyright
183
+ # "CPY",
184
+ # flake8-django
185
+ # "DJ",
186
+ # flake8-errmsg
187
+ # "EM",
188
+ # flake8-executable
189
+ # "EXE",
190
+ # flake8-fixme
191
+ # "FIX",
192
+ # flake8-future-annotations
193
+ # "FA",
194
+ # flake8-import-conventions
195
+ # "ICN",
196
+ # flake8-pyi
197
+ # "PYI",
198
+ # flake8-pytest-style
199
+ # "PT",
200
+ # flake8-todos
201
+ # "TD",
202
+ # mccabe
203
+ # "C90",
204
+ # NumPy-specific rules
205
+ # "NPY",
206
+ # pandas-vet
207
+ # "PD",
208
+ ]
File without changes
@@ -1,12 +1,14 @@
1
1
  from typing import Annotated
2
+
2
3
  from pydantic import Field
3
- from stidantic.types import StixCore, Identifier, StixCommon
4
- from stidantic.sdo import SDOs
5
- from stidantic.sco import SCOs
6
- from stidantic.sro import SROs
4
+
5
+ from stidantic.extension import ExtensionDefinition
7
6
  from stidantic.language import LanguageContent
8
7
  from stidantic.marking import MarkingDefinition
9
- from stidantic.extension import ExtensionDefinition
8
+ from stidantic.sco import SCOs
9
+ from stidantic.sdo import SDOs
10
+ from stidantic.sro import SROs
11
+ from stidantic.types import Identifier, StixCommon, StixCore
10
12
 
11
13
 
12
14
  # 8. Stix Bundle
@@ -15,14 +17,7 @@ class StixBundle(StixCore):
15
17
  type: str = "bundle"
16
18
  objects: list[
17
19
  Annotated[
18
- (
19
- SROs
20
- | SDOs
21
- | SCOs
22
- | MarkingDefinition
23
- | LanguageContent
24
- | ExtensionDefinition
25
- ),
20
+ (SROs | SDOs | SCOs | MarkingDefinition | LanguageContent | ExtensionDefinition),
26
21
  Field(discriminator="type"),
27
22
  ]
28
23
  | StixCommon
@@ -1,7 +1,9 @@
1
- from typing import Literal, Annotated, Self
1
+ from typing import Annotated, Literal, Self
2
+
2
3
  from pydantic import Field
3
4
  from pydantic.functional_validators import model_validator
4
- from stidantic.types import StixExtension, ExtensionType, StixProp
5
+
6
+ from stidantic.types import ExtensionType, StixExtension, StixProp
5
7
 
6
8
 
7
9
  # 7.3 Extension Definition
@@ -106,8 +108,7 @@ class ExtensionDefinition(StixExtension):
106
108
  top-level of an existing object.
107
109
  """
108
110
  if (
109
- self.extension_properties
110
- and ExtensionType.toplevel_property_extension not in self.extension_types
111
+ self.extension_properties and ExtensionType.toplevel_property_extension.value not in self.extension_types # pyright: ignore[reportUnnecessaryContains] because of use_enum_value=True
111
112
  ):
112
113
  raise ValueError(
113
114
  "extension_types property can't be used without toplevel-property-extension in extension_types."
File without changes