Skip to content

Upgrade default pattern to 2.1#95

Open
febrezo wants to merge 1 commit into
oasis-open:masterfrom
febrezo:swap-to-v21
Open

Upgrade default pattern to 2.1#95
febrezo wants to merge 1 commit into
oasis-open:masterfrom
febrezo:swap-to-v21

Conversation

@febrezo

@febrezo febrezo commented Jan 8, 2023

Copy link
Copy Markdown

The change permits the usage of importing the v2.1 Pattern class from stix2patterns.pattern by default instead of v2.0. With this update, this:

>>> from stix2patterns.pattern import Pattern
>>> p = Pattern("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
>>> dir(p)
['_Pattern__do_parse', '_Pattern__parse_tree', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'inspect', 'visit', 'walk']
>>> p.inspect()
pattern_data(comparisons={'file': [(['hashes', 'SHA-256'], '=', "'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f'")]}, observation_ops=set(), qualifiers=set())

Is now equivalent to:

>>> from stix2patterns.v21.pattern import Pattern
>>> p = Pattern("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
>>> dir(p)
['_Pattern__do_parse', '_Pattern__parse_tree', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'inspect', 'visit', 'walk']
>>> p.inspect()
pattern_data(comparisons={'file': [(['hashes', 'SHA-256'], '=', "'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f'")]}, observation_ops=set(), qualifiers=set())

The change permits the usage of importing the v2.1 `Pattern` class
from `stix2patterns.pattern` by default instead of v2.0.
@CLAassistant

CLAassistant commented Jan 8, 2023

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov-commenter

codecov-commenter commented Jan 9, 2023

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.03%. Comparing base (ead1801) to head (3d0c0cd).
⚠️ Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
stix2patterns/pattern.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   82.03%   82.03%           
=======================================
  Files          31       31           
  Lines        4925     4925           
=======================================
  Hits         4040     4040           
  Misses        885      885           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants