-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add is_sdo() et al functions #483
Conversation
while I address circular import problems.
circular import refactoring. I think I just forgot to include this in the previous commit...
really just a simple accessor into the class maps table), and change other code to use it, in places where it was simple and made sense.
since this *is* in the stix2 library!
level with STIX versions in the same format as is used everywhere else in the API: "X.Y", as opposed to the "vXY" format used by the version-specific python packages. This eliminates all of the awkward conversion from public API format to "vXX" format. Also a little bit of code rearranging in the registration module to ensure that some STIX 2.1-specific checks are done whether version 2.1 is given explicitly or is defaulted to. In the same module I also added a missing import of stix2.properties, since my IDE was claiming it could not find a function from that module.
class map structure is keyed by normal "X.Y" style versions, the convenience that function provided is no longer necessary. So it no longer makes sense to have the function (at least, not for that reason). Change users of that function to use the STIX2_OBJ_MAPS structure directly.
and I probably forgot some stuff...
dict/mapping values: do a simple verification of the value's STIX version, not just its type. Added a lot more unit tests to test behavior on dicts. To make the implementation work, I had to move the detect_spec_version() function out of the parsing module and into utils. So that required small changes at all its previous call sites.
functions. Changed some ">= 2.1" stix version semantics to be "== 2.1", because we don't have any version >= 2.1, so they are currently equivalent, and the is_*() functions don't support STIX version ranges. They only support exact versions. We can look at this again if a newer STIX version ever emerges. Also added a class_for_type() function to the registry module, which was useful for the versioning module changes described above. I thought that function would be helpful in the parsing module, to simplify code there, so I changed that module a bit to use it.
properties of a 2.1 SCO with UUIDv5 ID, when creating a new version.
class in the registry when you have an instance of one of those classes. Because in that case, you can just get the class of the instance and not deal with the registry at all.
module, since we no longer support python2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple comments.
update to is_sro() as well, so it doesn't talk as if you can register custom SROs. That didn't actually make sense.
stix2.core module.
Codecov Report
@@ Coverage Diff @@
## master #483 +/- ##
==========================================
+ Coverage 89.27% 89.31% +0.03%
==========================================
Files 146 147 +1
Lines 16032 16245 +213
==========================================
+ Hits 14313 14509 +196
- Misses 1719 1736 +17
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @chisholm!
Fixes #450
Other changes include: