Skip to content
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

Upgrade default pattern to 2.1 #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

febrezo
Copy link

@febrezo febrezo commented Jan 8, 2023

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
Copy link

CLAassistant commented Jan 8, 2023

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2023

Codecov Report

Merging #95 (3d0c0cd) into master (ead1801) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   82.03%   82.03%           
=======================================
  Files          31       31           
  Lines        4925     4925           
=======================================
  Hits         4040     4040           
  Misses        885      885           
Impacted Files Coverage Δ
stix2patterns/pattern.py 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

None yet

3 participants