diff --git a/pandas/core/computation/align.py b/pandas/core/computation/align.py index 22c8b641cf974c..f7f40a66af9c63 100644 --- a/pandas/core/computation/align.py +++ b/pandas/core/computation/align.py @@ -1,15 +1,16 @@ """Core eval alignment algorithms """ -import warnings from functools import partial, wraps -from pandas.compat import zip, range +import warnings import numpy as np +from pandas.compat import range, zip +from pandas.errors import PerformanceWarning + import pandas as pd from pandas import compat -from pandas.errors import PerformanceWarning import pandas.core.common as com from pandas.core.computation.common import _result_type_many diff --git a/pandas/core/computation/check.py b/pandas/core/computation/check.py index 06f72bb36de5cb..d2d5e018063ff1 100644 --- a/pandas/core/computation/check.py +++ b/pandas/core/computation/check.py @@ -1,5 +1,5 @@ -import warnings from distutils.version import LooseVersion +import warnings _NUMEXPR_INSTALLED = False _MIN_NUMEXPR_VERSION = "2.6.1" diff --git a/pandas/core/computation/common.py b/pandas/core/computation/common.py index 105cc497a4207e..e7eca04e413c5a 100644 --- a/pandas/core/computation/common.py +++ b/pandas/core/computation/common.py @@ -1,7 +1,9 @@ import numpy as np -import pandas as pd + from pandas.compat import reduce +import pandas as pd + def _ensure_decoded(s): """ if we have bytes, decode them to unicode """ diff --git a/pandas/core/computation/engines.py b/pandas/core/computation/engines.py index 155ff554cf99c2..bccd37131c81a8 100644 --- a/pandas/core/computation/engines.py +++ b/pandas/core/computation/engines.py @@ -4,14 +4,14 @@ import abc -from pandas import compat from pandas.compat import map -import pandas.io.formats.printing as printing + +from pandas import compat from pandas.core.computation.align import _align, _reconstruct_object from pandas.core.computation.ops import ( - UndefinedVariableError, - _mathops, _reductions) + UndefinedVariableError, _mathops, _reductions) +import pandas.io.formats.printing as printing _ne_builtins = frozenset(_mathops + _reductions) diff --git a/pandas/core/computation/eval.py b/pandas/core/computation/eval.py index 7025f3000eb5f4..4b9ba02ed85a45 100644 --- a/pandas/core/computation/eval.py +++ b/pandas/core/computation/eval.py @@ -3,14 +3,17 @@ """Top level ``eval`` module. """ -import warnings import tokenize -from pandas.io.formats.printing import pprint_thing -from pandas.core.computation.scope import _ensure_scope +import warnings + from pandas.compat import string_types -from pandas.core.computation.engines import _engines from pandas.util._validators import validate_bool_kwarg +from pandas.core.computation.engines import _engines +from pandas.core.computation.scope import _ensure_scope + +from pandas.io.formats.printing import pprint_thing + def _check_engine(engine): """Make sure a valid engine is passed. diff --git a/pandas/core/computation/expr.py b/pandas/core/computation/expr.py index b68b6970a89cc0..9a44198ba3b862 100644 --- a/pandas/core/computation/expr.py +++ b/pandas/core/computation/expr.py @@ -2,25 +2,25 @@ """ import ast +from functools import partial import tokenize -from functools import partial import numpy as np +from pandas.compat import StringIO, lmap, reduce, string_types, zip + import pandas as pd from pandas import compat -from pandas.compat import StringIO, lmap, zip, reduce, string_types -from pandas.core.base import StringMixin from pandas.core import common as com -import pandas.io.formats.printing as printing -from pandas.core.reshape.util import compose +from pandas.core.base import StringMixin from pandas.core.computation.ops import ( - _cmp_ops_syms, _bool_ops_syms, - _arith_ops_syms, _unary_ops_syms, is_term) -from pandas.core.computation.ops import _reductions, _mathops, _LOCAL_TAG -from pandas.core.computation.ops import Op, BinOp, UnaryOp, Term, Constant, Div -from pandas.core.computation.ops import UndefinedVariableError, FuncNode + _LOCAL_TAG, BinOp, Constant, Div, FuncNode, Op, Term, UnaryOp, + UndefinedVariableError, _arith_ops_syms, _bool_ops_syms, _cmp_ops_syms, + _mathops, _reductions, _unary_ops_syms, is_term) from pandas.core.computation.scope import Scope +from pandas.core.reshape.util import compose + +import pandas.io.formats.printing as printing def tokenize_string(source): diff --git a/pandas/core/computation/expressions.py b/pandas/core/computation/expressions.py index c12056a3ee78c2..d44fae624a91c3 100644 --- a/pandas/core/computation/expressions.py +++ b/pandas/core/computation/expressions.py @@ -7,6 +7,7 @@ """ import warnings + import numpy as np import pandas.core.common as com diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index ca0c4db4947c4f..9e9f124352229f 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -1,21 +1,23 @@ """Operator classes for eval. """ -import operator as op -from functools import partial from datetime import datetime +from functools import partial +import operator as op import numpy as np +from pandas.compat import PY3, string_types, text_type + from pandas.core.dtypes.common import is_list_like, is_scalar + import pandas as pd -from pandas.compat import PY3, string_types, text_type -import pandas.core.common as com -from pandas.io.formats.printing import pprint_thing, pprint_thing_encoded from pandas.core.base import StringMixin +import pandas.core.common as com from pandas.core.computation.common import _ensure_decoded, _result_type_many from pandas.core.computation.scope import _DEFAULT_GLOBALS +from pandas.io.formats.printing import pprint_thing, pprint_thing_encoded _reductions = 'sum', 'prod' diff --git a/pandas/core/computation/pytables.py b/pandas/core/computation/pytables.py index e08df3e3401386..db409b215a78d2 100644 --- a/pandas/core/computation/pytables.py +++ b/pandas/core/computation/pytables.py @@ -2,20 +2,24 @@ import ast from functools import partial + import numpy as np -import pandas as pd + +from pandas.compat import DeepChainMap, string_types, u from pandas.core.dtypes.common import is_list_like -import pandas.core.common as com -from pandas.compat import u, string_types, DeepChainMap + +import pandas as pd from pandas.core.base import StringMixin -from pandas.io.formats.printing import pprint_thing, pprint_thing_encoded +import pandas.core.common as com from pandas.core.computation import expr, ops -from pandas.core.computation.ops import is_term, UndefinedVariableError -from pandas.core.computation.expr import BaseExprVisitor from pandas.core.computation.common import _ensure_decoded +from pandas.core.computation.expr import BaseExprVisitor +from pandas.core.computation.ops import UndefinedVariableError, is_term from pandas.core.tools.timedeltas import _coerce_scalar_to_timedelta_type +from pandas.io.formats.printing import pprint_thing, pprint_thing_encoded + class Scope(expr.Scope): __slots__ = 'queryables', diff --git a/pandas/core/computation/scope.py b/pandas/core/computation/scope.py index c3128be0f5599d..33c5a1c2e0f0ad 100644 --- a/pandas/core/computation/scope.py +++ b/pandas/core/computation/scope.py @@ -2,18 +2,18 @@ Module for scope operations """ -import sys -import struct -import inspect import datetime +import inspect import itertools import pprint +import struct +import sys import numpy as np -import pandas +from pandas.compat import DeepChainMap, StringIO, map + import pandas as pd # noqa -from pandas.compat import DeepChainMap, map, StringIO from pandas.core.base import StringMixin import pandas.core.computation as compu @@ -48,7 +48,7 @@ def _raw_hex_id(obj): _DEFAULT_GLOBALS = { - 'Timestamp': pandas._libs.tslib.Timestamp, + 'Timestamp': pd._libs.tslib.Timestamp, 'datetime': datetime.datetime, 'True': True, 'False': False, diff --git a/setup.cfg b/setup.cfg index 0b50006caea87d..717705ca028c9f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -164,16 +164,6 @@ skip= pandas/core/sparse/series.py, pandas/core/sparse/frame.py, pandas/core/sparse/scipy_sparse.py, - pandas/core/computation/check.py, - pandas/core/computation/ops.py, - pandas/core/computation/pytables.py, - pandas/core/computation/eval.py, - pandas/core/computation/expressions.py, - pandas/core/computation/common.py, - pandas/core/computation/engines.py, - pandas/core/computation/expr.py, - pandas/core/computation/align.py, - pandas/core/computation/scope.py, pandas/tests/test_errors.py, pandas/tests/test_base.py, pandas/tests/test_register_accessor.py,