re-order imports, add entry to isort file
parent
b3f69bf942
commit
fc0069ed60
|
@ -2,6 +2,7 @@
|
||||||
skip = workbench.py
|
skip = workbench.py
|
||||||
not_skip = __init__.py
|
not_skip = __init__.py
|
||||||
known_third_party =
|
known_third_party =
|
||||||
|
antlr4,
|
||||||
dateutil,
|
dateutil,
|
||||||
medallion,
|
medallion,
|
||||||
pytest,
|
pytest,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import importlib
|
import importlib
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
from antlr4 import CommonTokenStream, InputStream
|
||||||
import six
|
import six
|
||||||
from stix2patterns.grammars.STIXPatternLexer import STIXPatternLexer
|
from stix2patterns.grammars.STIXPatternLexer import STIXPatternLexer
|
||||||
from stix2patterns.grammars.STIXPatternParser import (STIXPatternParser,
|
from stix2patterns.grammars.STIXPatternParser import (STIXPatternParser,
|
||||||
|
@ -8,15 +9,11 @@ from stix2patterns.grammars.STIXPatternParser import (STIXPatternParser,
|
||||||
from stix2patterns.grammars.STIXPatternVisitor import STIXPatternVisitor
|
from stix2patterns.grammars.STIXPatternVisitor import STIXPatternVisitor
|
||||||
from stix2patterns.validator import STIXPatternErrorListener
|
from stix2patterns.validator import STIXPatternErrorListener
|
||||||
|
|
||||||
from antlr4 import CommonTokenStream, InputStream
|
from .patterns import (BinaryConstant, BooleanConstant, FloatConstant,
|
||||||
from stix2.patterns import (BinaryConstant, BooleanConstant, FloatConstant,
|
|
||||||
FollowedByObservationExpression, HexConstant,
|
FollowedByObservationExpression, HexConstant,
|
||||||
IntegerConstant, RepeatQualifier,
|
IntegerConstant, RepeatQualifier, StartStopQualifier,
|
||||||
StartStopQualifier, StringConstant,
|
StringConstant, TimestampConstant, WithinQualifier,
|
||||||
TimestampConstant, WithinQualifier)
|
_BooleanExpression)
|
||||||
from stix2.patterns import _BooleanExpression # noqa
|
|
||||||
|
|
||||||
from .patterns import * # noqa: F403, F401
|
|
||||||
|
|
||||||
|
|
||||||
def collapse_lists(lists):
|
def collapse_lists(lists):
|
||||||
|
@ -46,7 +43,7 @@ class STIXPatternVisitorForSTIX2(STIXPatternVisitor):
|
||||||
def __init__(self, module_suffix, module_name):
|
def __init__(self, module_suffix, module_name):
|
||||||
if module_suffix and module_name:
|
if module_suffix and module_name:
|
||||||
self.module_suffix = module_suffix
|
self.module_suffix = module_suffix
|
||||||
if STIXPatternVisitorForSTIX2.classes == {}:
|
if not STIXPatternVisitorForSTIX2.classes:
|
||||||
module = importlib.import_module(module_name)
|
module = importlib.import_module(module_name)
|
||||||
for k, c in inspect.getmembers(module, inspect.isclass):
|
for k, c in inspect.getmembers(module, inspect.isclass):
|
||||||
STIXPatternVisitorForSTIX2.classes[k] = c
|
STIXPatternVisitorForSTIX2.classes[k] = c
|
||||||
|
|
Loading…
Reference in New Issue