Skip to content

Commit

Permalink
CLN: make submodules of pandas.util private
Browse files Browse the repository at this point in the history
xref pandas-dev#13634

CLN: move pandas.util.*

validators, depr_module, decorators, print_versions

to _ leading
  • Loading branch information
jreback committed May 4, 2017
1 parent 4a748cc commit f7f324b
Show file tree
Hide file tree
Showing 75 changed files with 423 additions and 380 deletions.
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/attrs_caching.py
@@ -1,5 +1,5 @@
from .pandas_vb_common import *
from pandas.util.decorators import cache_readonly
from pandas.util._decorators import cache_readonly


class DataFrameAttributes(object):
Expand Down
2 changes: 1 addition & 1 deletion doc/source/merging.rst
Expand Up @@ -13,7 +13,7 @@
import matplotlib.pyplot as plt
plt.close('all')
import pandas.util.doctools as doctools
import pandas.util._doctools as doctools
p = doctools.TablePlotter()
Expand Down
11 changes: 6 additions & 5 deletions doc/source/whatsnew/v0.20.0.txt
Expand Up @@ -1238,10 +1238,10 @@ If indicated, a deprecation warning will be issued if you reference theses modul
"pandas.types", "pandas.core.dtypes", ""
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
"pandas._join", "pandas._libs.join", ""
"pandas._hash", "pandas.util.libhashing", ""
"pandas._hash", "pandas._libs.hashing", ""
"pandas._period", "pandas._libs.period", ""
"pandas._sparse", "pandas.core.sparse.libsparse", ""
"pandas._testing", "pandas.util.libtesting", ""
"pandas._testing", "pandas.util._testing", ""
"pandas._window", "pandas.core.libwindow", ""


Expand All @@ -1254,6 +1254,8 @@ these are now the public subpackages.

- The function :func:`~pandas.api.types.union_categoricals` is now importable from ``pandas.api.types``, formerly from ``pandas.types.concat`` (:issue:`15998`)
- The type import ``pandas.tslib.NaTType`` is deprecated and can be replaced by using ``type(pandas.NaT)`` (:issue:`16146`)
- The public functions in ``pandas.util.hashing`` deprecated from that locations, but are now importable from ``pandas.util`` (:issue:`16223`)
- The modules in ``pandas.util``: ``decorators``, ``print_versions``, ``doctools``, `validators``, ``depr_module`` are now private (:issue:`16223`)

.. _whatsnew_0200.privacy.errors:

Expand All @@ -1278,7 +1280,7 @@ The following are now part of this API:
'UnsupportedFunctionCall']


.. _whatsnew_0200.privay.testing:
.. _whatsnew_0200.privacy.testing:

``pandas.testing``
^^^^^^^^^^^^^^^^^^
Expand All @@ -1292,14 +1294,13 @@ The following testing functions are now part of this API:
- :func:`testing.assert_index_equal`


.. _whatsnew_0200.privay.plotting:
.. _whatsnew_0200.privacy.plotting:

``pandas.plotting``
^^^^^^^^^^^^^^^^^^^

A new public ``pandas.plotting`` module has been added that holds plotting functionality that was previously in either ``pandas.tools.plotting`` or in the top-level namespace. See the :ref:`deprecations sections <whatsnew_0200.privacy.deprecate_plotting>` for more details.


.. _whatsnew_0200.privacy.development:

Other Development Changes
Expand Down
6 changes: 3 additions & 3 deletions pandas/__init__.py
Expand Up @@ -50,17 +50,17 @@
import pandas.tools.plotting
plot_params = pandas.plotting._style._Options(deprecated=True)
# do not import deprecate to top namespace
scatter_matrix = pandas.util.decorators.deprecate(
scatter_matrix = pandas.util._decorators.deprecate(
'pandas.scatter_matrix', pandas.plotting.scatter_matrix,
'pandas.plotting.scatter_matrix')

from pandas.util.print_versions import show_versions
from pandas.util._print_versions import show_versions
from pandas.io.api import *
from pandas.util._tester import test
import pandas.testing

# extension module deprecations
from pandas.util.depr_module import _DeprecatedModule
from pandas.util._depr_module import _DeprecatedModule

json = _DeprecatedModule(deprmod='pandas.json',
moved={'dumps': 'pandas.io.json.dumps',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pandas/compat/numpy/function.py
Expand Up @@ -19,8 +19,8 @@
"""

from numpy import ndarray
from pandas.util.validators import (validate_args, validate_kwargs,
validate_args_and_kwargs)
from pandas.util._validators import (validate_args, validate_kwargs,
validate_args_and_kwargs)
from pandas.errors import UnsupportedFunctionCall
from pandas.core.dtypes.common import is_integer, is_bool
from pandas.compat import OrderedDict
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/api.py
Expand Up @@ -35,7 +35,7 @@
from pandas.core.resample import TimeGrouper

# see gh-14094.
from pandas.util.depr_module import _DeprecatedModule
from pandas.util._depr_module import _DeprecatedModule

_removals = ['day', 'bday', 'businessDay', 'cday', 'customBusinessDay',
'customBusinessMonthEnd', 'customBusinessMonthBegin',
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/base.py
Expand Up @@ -9,14 +9,14 @@
from pandas.core.dtypes.missing import isnull
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries, ABCIndexClass
from pandas.core.dtypes.common import is_object_dtype, is_list_like, is_scalar
from pandas.util.validators import validate_bool_kwarg
from pandas.util._validators import validate_bool_kwarg

from pandas.core import common as com
import pandas.core.nanops as nanops
import pandas._libs.lib as lib
from pandas.compat.numpy import function as nv
from pandas.util.decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)
from pandas.util._decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)
from pandas.core.common import AbstractMethodError

_shared_docs = dict()
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/categorical.py
Expand Up @@ -34,11 +34,11 @@
import pandas.core.common as com
from pandas.core.missing import interpolate_2d
from pandas.compat.numpy import function as nv
from pandas.util.decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)
from pandas.util._decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)

from pandas.util.terminal import get_terminal_size
from pandas.util.validators import validate_bool_kwarg
from pandas.io.formats.terminal import get_terminal_size
from pandas.util._validators import validate_bool_kwarg
from pandas.core.config import get_option


Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/eval.py
Expand Up @@ -11,7 +11,7 @@
from pandas.core.computation.scope import _ensure_scope
from pandas.compat import string_types
from pandas.core.computation.engines import _engines
from pandas.util.validators import validate_bool_kwarg
from pandas.util._validators import validate_bool_kwarg


def _check_engine(engine):
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Expand Up @@ -80,8 +80,8 @@
OrderedDict, raise_with_traceback)
from pandas import compat
from pandas.compat.numpy import function as nv
from pandas.util.decorators import Appender, Substitution
from pandas.util.validators import validate_bool_kwarg
from pandas.util._decorators import Appender, Substitution
from pandas.util._validators import validate_bool_kwarg

from pandas.core.indexes.period import PeriodIndex
from pandas.core.indexes.datetimes import DatetimeIndex
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/generic.py
Expand Up @@ -51,8 +51,8 @@
from pandas.compat import (map, zip, lzip, lrange, string_types,
isidentifier, set_function_name)
import pandas.core.nanops as nanops
from pandas.util.decorators import Appender, Substitution, deprecate_kwarg
from pandas.util.validators import validate_bool_kwarg
from pandas.util._decorators import Appender, Substitution, deprecate_kwarg
from pandas.util._validators import validate_bool_kwarg
from pandas.core import config

# goal is to be able to define the docs close to function, while still being
Expand Down Expand Up @@ -1382,7 +1382,7 @@ def to_clipboard(self, excel=None, sep=None, **kwargs):
- Windows: none
- OS X: none
"""
from pandas.io import clipboard
from pandas.io.clipboard import clipboard
clipboard.to_clipboard(self, excel=excel, sep=sep, **kwargs)

def to_xarray(self):
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/groupby.py
Expand Up @@ -54,10 +54,10 @@
from pandas.core.sorting import (get_group_index_sorter, get_group_index,
compress_group_index, get_flattened_iterator,
decons_obs_group_ids, get_indexer_dict)
from pandas.util.decorators import (cache_readonly, Substitution,
Appender, make_signature)
from pandas.util._decorators import (cache_readonly, Substitution,
Appender, make_signature)
from pandas.io.formats.printing import pprint_thing
from pandas.util.validators import validate_kwargs
from pandas.util._validators import validate_kwargs

import pandas.core.algorithms as algorithms
import pandas.core.common as com
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/base.py
Expand Up @@ -41,8 +41,8 @@

from pandas.core.base import PandasObject, IndexOpsMixin
import pandas.core.base as base
from pandas.util.decorators import (Appender, Substitution, cache_readonly,
deprecate, deprecate_kwarg)
from pandas.util._decorators import (Appender, Substitution, cache_readonly,
deprecate, deprecate_kwarg)
from pandas.core.indexes.frozen import FrozenList
import pandas.core.common as com
import pandas.core.dtypes.concat as _concat
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/category.py
Expand Up @@ -16,7 +16,7 @@
from pandas.core.algorithms import take_1d


from pandas.util.decorators import Appender, cache_readonly
from pandas.util._decorators import Appender, cache_readonly
from pandas.core.config import get_option
from pandas.core.indexes.base import Index, _index_shared_docs
import pandas.core.base as base
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/datetimelike.py
Expand Up @@ -28,7 +28,7 @@
from pandas._libs.period import Period

from pandas.core.indexes.base import Index, _index_shared_docs
from pandas.util.decorators import Appender, cache_readonly
from pandas.util._decorators import Appender, cache_readonly
import pandas.core.dtypes.concat as _concat
import pandas.tseries.frequencies as frequencies

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/datetimes.py
Expand Up @@ -41,8 +41,8 @@
from pandas.core.tools.datetimes import (
parse_time_string, normalize_date, to_time)
from pandas.core.tools.timedeltas import to_timedelta
from pandas.util.decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)
from pandas.util._decorators import (Appender, cache_readonly,
deprecate_kwarg, Substitution)
import pandas.core.common as com
import pandas.tseries.offsets as offsets
import pandas.core.tools.datetimes as tools
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/interval.py
Expand Up @@ -28,7 +28,7 @@
from pandas.core.indexes.multi import MultiIndex
from pandas.compat.numpy import function as nv
from pandas.core import common as com
from pandas.util.decorators import cache_readonly, Appender
from pandas.util._decorators import cache_readonly, Appender
from pandas.core.config import get_option

import pandas.core.indexes.base as ibase
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/indexes/multi.py
Expand Up @@ -26,8 +26,8 @@
is_null_slice)

import pandas.core.base as base
from pandas.util.decorators import (Appender, cache_readonly,
deprecate, deprecate_kwarg)
from pandas.util._decorators import (Appender, cache_readonly,
deprecate, deprecate_kwarg)
import pandas.core.common as com
import pandas.core.missing as missing
import pandas.core.algorithms as algos
Expand Down Expand Up @@ -718,7 +718,7 @@ def _inferred_type_levels(self):
@cache_readonly
def _hashed_values(self):
""" return a uint64 ndarray of my hashed values """
from pandas.util.hashing import hash_tuples
from pandas.core.util.hashing import hash_tuples
return hash_tuples(self)

def _hashed_indexing_key(self, key):
Expand All @@ -740,7 +740,7 @@ def _hashed_indexing_key(self, key):
we need to stringify if we have mixed levels
"""
from pandas.util.hashing import hash_tuples
from pandas.core.util.hashing import hash_tuples

if not isinstance(key, tuple):
return hash_tuples(key)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/numeric.py
Expand Up @@ -11,7 +11,7 @@
from pandas.core import algorithms
from pandas.core.indexes.base import (
Index, InvalidIndexError, _index_shared_docs)
from pandas.util.decorators import Appender, cache_readonly
from pandas.util._decorators import Appender, cache_readonly
import pandas.core.indexes.base as ibase


Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/period.py
Expand Up @@ -40,8 +40,8 @@
from pandas.core.indexes.base import _index_shared_docs, _ensure_index

from pandas import compat
from pandas.util.decorators import (Appender, Substitution, cache_readonly,
deprecate_kwarg)
from pandas.util._decorators import (Appender, Substitution, cache_readonly,
deprecate_kwarg)
from pandas.compat import zip, u

import pandas.core.indexes.base as ibase
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/range.py
Expand Up @@ -13,7 +13,7 @@
from pandas.compat import lrange, range
from pandas.compat.numpy import function as nv
from pandas.core.indexes.base import Index, _index_shared_docs
from pandas.util.decorators import Appender, cache_readonly
from pandas.util._decorators import Appender, cache_readonly
import pandas.core.indexes.base as ibase

from pandas.core.indexes.numeric import Int64Index
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/timedeltas.py
Expand Up @@ -27,7 +27,7 @@
from pandas.core.indexes.base import _index_shared_docs
import pandas.core.common as com
import pandas.core.dtypes.concat as _concat
from pandas.util.decorators import Appender, Substitution, deprecate_kwarg
from pandas.util._decorators import Appender, Substitution, deprecate_kwarg
from pandas.core.indexes.datetimelike import TimelikeOps, DatetimeIndexOpsMixin
from pandas.core.tools.timedeltas import (
to_timedelta, _coerce_scalar_to_timedelta_type)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/internals.py
Expand Up @@ -64,8 +64,8 @@
from pandas._libs.lib import BlockPlacement

import pandas.core.computation.expressions as expressions
from pandas.util.decorators import cache_readonly
from pandas.util.validators import validate_bool_kwarg
from pandas.util._decorators import cache_readonly
from pandas.util._validators import validate_bool_kwarg

from pandas import compat, _np_version_under1p9
from pandas.compat import range, map, zip, u
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/ops.py
Expand Up @@ -15,7 +15,7 @@
tslib as libts, algos as libalgos, iNaT)

from pandas import compat
from pandas.util.decorators import Appender
from pandas.util._decorators import Appender
import pandas.core.computation.expressions as expressions

from pandas.compat import bind_method
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/panel.py
Expand Up @@ -34,7 +34,7 @@
from pandas.core.ops import _op_descriptions
from pandas.core.series import Series
from pandas.core.reshape.util import cartesian_product
from pandas.util.decorators import (deprecate, Appender)
from pandas.util._decorators import (deprecate, Appender)

_shared_doc_kwargs = dict(
axes='items, major_axis, minor_axis',
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/resample.py
Expand Up @@ -25,7 +25,7 @@
from pandas._libs.lib import Timestamp
from pandas._libs.period import IncompatibleFrequency

from pandas.util.decorators import Appender
from pandas.util._decorators import Appender
from pandas.core.generic import _shared_docs
_shared_docs_kwargs = dict()

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/reshape/merge.py
Expand Up @@ -34,7 +34,7 @@
from pandas.core.dtypes.missing import na_value_for_dtype
from pandas.core.internals import (items_overlap_with_suffix,
concatenate_block_managers)
from pandas.util.decorators import Appender, Substitution
from pandas.util._decorators import Appender, Substitution

from pandas.core.sorting import is_int64_overflow_possible
import pandas.core.algorithms as algos
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/reshape/reshape.py
Expand Up @@ -30,7 +30,7 @@
from pandas._libs import algos as _algos, reshape as _reshape

from pandas.core.frame import _shared_docs
from pandas.util.decorators import Appender
from pandas.util._decorators import Appender
from pandas.core.index import MultiIndex, _get_na_value


Expand Down
6 changes: 3 additions & 3 deletions pandas/core/series.py
Expand Up @@ -60,7 +60,7 @@
from pandas.core.indexes.timedeltas import TimedeltaIndex
from pandas.core.indexes.period import PeriodIndex
from pandas import compat
from pandas.util.terminal import get_terminal_size
from pandas.io.formats.terminal import get_terminal_size
from pandas.compat import zip, u, OrderedDict, StringIO
from pandas.compat.numpy import function as nv

Expand All @@ -70,8 +70,8 @@
import pandas.core.common as com
import pandas.core.nanops as nanops
import pandas.io.formats.format as fmt
from pandas.util.decorators import Appender, deprecate_kwarg, Substitution
from pandas.util.validators import validate_bool_kwarg
from pandas.util._decorators import Appender, deprecate_kwarg, Substitution
from pandas.util._validators import validate_bool_kwarg

from pandas._libs import index as libindex, tslib as libts, lib, iNaT
from pandas.core.config import get_option
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/sparse/array.py
Expand Up @@ -35,7 +35,7 @@
import pandas.core.algorithms as algos
import pandas.core.ops as ops
import pandas.io.formats.printing as printing
from pandas.util.decorators import Appender
from pandas.util._decorators import Appender
from pandas.core.indexes.base import _index_shared_docs


Expand Down

0 comments on commit f7f324b

Please sign in to comment.