re-order imports, add entry to isort file

master
Emmanuelle Vargas-Gonzalez 2018-12-10 14:29:31 -05:00
parent b3f69bf942
commit fc0069ed60
2 changed files with 8 additions and 10 deletions

View File

@ -2,6 +2,7 @@
skip = workbench.py
not_skip = __init__.py
known_third_party =
antlr4,
dateutil,
medallion,
pytest,

View File

@ -1,6 +1,7 @@
import importlib
import inspect
from antlr4 import CommonTokenStream, InputStream
import six
from stix2patterns.grammars.STIXPatternLexer import STIXPatternLexer
from stix2patterns.grammars.STIXPatternParser import (STIXPatternParser,
@ -8,15 +9,11 @@ from stix2patterns.grammars.STIXPatternParser import (STIXPatternParser,
from stix2patterns.grammars.STIXPatternVisitor import STIXPatternVisitor
from stix2patterns.validator import STIXPatternErrorListener
from antlr4 import CommonTokenStream, InputStream
from stix2.patterns import (BinaryConstant, BooleanConstant, FloatConstant,
FollowedByObservationExpression, HexConstant,
IntegerConstant, RepeatQualifier,
StartStopQualifier, StringConstant,
TimestampConstant, WithinQualifier)
from stix2.patterns import _BooleanExpression # noqa
from .patterns import * # noqa: F403, F401
from .patterns import (BinaryConstant, BooleanConstant, FloatConstant,
FollowedByObservationExpression, HexConstant,
IntegerConstant, RepeatQualifier, StartStopQualifier,
StringConstant, TimestampConstant, WithinQualifier,
_BooleanExpression)
def collapse_lists(lists):
@ -46,7 +43,7 @@ class STIXPatternVisitorForSTIX2(STIXPatternVisitor):
def __init__(self, module_suffix, module_name):
if module_suffix and module_name:
self.module_suffix = module_suffix
if STIXPatternVisitorForSTIX2.classes == {}:
if not STIXPatternVisitorForSTIX2.classes:
module = importlib.import_module(module_name)
for k, c in inspect.getmembers(module, inspect.isclass):
STIXPatternVisitorForSTIX2.classes[k] = c