Skip to content

Commit

Permalink
MAINT: restore access to deprecated private namespaces
Browse files Browse the repository at this point in the history
These all had compatibility shims for direct import (e.g.
`from scipy.io import arff`), but not for access like:

    from scipy import io
    io.arff.xxx

This restores that access. The changes in this commit don't trigger
a deprecation warning, however use of any object in the now-restored
namespaces will trigger such a warning.
  • Loading branch information
rgommers committed Nov 9, 2021
1 parent d7fa27f commit 7b3d947
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 1 deletion.
3 changes: 3 additions & 0 deletions scipy/constants/__init__.py
Expand Up @@ -332,6 +332,9 @@

del _constant_names

# Deprecated namespaces, to be removed in v2.0.0
from . import codata, constants

__all__ = [s for s in dir() if not s.startswith('_')]

from scipy._lib._testutils import PytestTester
Expand Down
3 changes: 3 additions & 0 deletions scipy/fftpack/__init__.py
Expand Up @@ -96,6 +96,9 @@
from ._helper import *
from ._realtransforms import *

# Deprecated namespaces, to be removed in v2.0.0
from . import basic, helper, pseudo_diffs, realtransforms

from scipy._lib._testutils import PytestTester
test = PytestTester(__name__)
del PytestTester
3 changes: 3 additions & 0 deletions scipy/integrate/__init__.py
Expand Up @@ -98,6 +98,9 @@
OdeSolver, RK23, RK45, DOP853, Radau, BDF, LSODA)
from ._quad_vec import quad_vec

# Deprecated namespaces, to be removed in v2.0.0
from . import dop, lsoda, vode

__all__ = [s for s in dir() if not s.startswith('_')]

from scipy._lib._testutils import PytestTester
Expand Down
3 changes: 3 additions & 0 deletions scipy/interpolate/__init__.py
Expand Up @@ -183,6 +183,9 @@

from ._pade import *

# Deprecated namespaces, to be removed in v2.0.0
from . import fitpack, fitpack2, interpolate, ndgriddata, polyint

__all__ = [s for s in dir() if not s.startswith('_')]

from scipy._lib._testutils import PytestTester
Expand Down
3 changes: 3 additions & 0 deletions scipy/io/__init__.py
Expand Up @@ -106,6 +106,9 @@
from ._idl import readsav
from ._harwell_boeing import hb_read, hb_write

# Deprecated namespaces, to be removed in v2.0.0
from . import arff, harwell_boeing, idl, matlab, mmio, netcdf, wavfile

__all__ = [s for s in dir() if not s.startswith('_')]

from scipy._lib._testutils import PytestTester
Expand Down
6 changes: 6 additions & 0 deletions scipy/linalg/__init__.py
Expand Up @@ -217,6 +217,12 @@
from ._sketches import *
from ._decomp_cossin import *

# Deprecated namespaces, to be removed in v2.0.0
from . import (
decomp, decomp_cholesky, decomp_lu, decomp_qr, decomp_svd, decomp_schur,
basic, misc, special_matrices,
)

__all__ = [s for s in dir() if not s.startswith('_')]


Expand Down
3 changes: 3 additions & 0 deletions scipy/misc/__init__.py
Expand Up @@ -22,6 +22,9 @@
from ._common import *
from . import _common

# Deprecated namespaces, to be removed in v2.0.0
from . import common, doccer

__all__ = _common.__all__

del _common
Expand Down
3 changes: 2 additions & 1 deletion scipy/ndimage/__init__.py
Expand Up @@ -159,7 +159,8 @@
from . import measurements # noqa: F401
from . import morphology # noqa: F401

__version__ = '2.0'
# Deprecated namespaces, to be removed in v2.0.0
from . import filters, fourier, interpolation, measurements, morphology

__all__ = [s for s in dir() if not s.startswith('_')]

Expand Down
3 changes: 3 additions & 0 deletions scipy/odr/__init__.py
Expand Up @@ -120,6 +120,9 @@ def f(B, x):
from ._models import *
from . import _add_newdocs

# Deprecated namespaces, to be removed in v2.0.0
from . import models, odrpack

__all__ = [s for s in dir()
if not (s.startswith('_') or s in ('odr_stop', 'odr_error'))]

Expand Down
6 changes: 6 additions & 0 deletions scipy/optimize/__init__.py
Expand Up @@ -421,6 +421,12 @@
from ._dual_annealing import dual_annealing
from ._qap import quadratic_assignment

# Deprecated namespaces, to be removed in v2.0.0
from . import (
cobyla, lbfgsb, linesearch, minpack, minpack2, moduleTNC, nonlin, optimize,
slsqp, tnc, zeros
)

__all__ = [s for s in dir() if not s.startswith('_')]

from scipy._lib._testutils import PytestTester
Expand Down
5 changes: 5 additions & 0 deletions scipy/signal/__init__.py
Expand Up @@ -360,6 +360,11 @@ def wrapped(*args, **kwargs):

del deprecated_windows, name, deco

# Deprecated namespaces, to be removed in v2.0.0
from . import (
bsplines, filter_design, fir_filter_design, lti_conversion, ltisys,
spectral, signaltools, waveforms, wavelets,
)

__all__ = [s for s in dir() if not s.startswith('_')]

Expand Down
3 changes: 3 additions & 0 deletions scipy/signal/windows/__init__.py
Expand Up @@ -40,6 +40,9 @@

from ._windows import *

# Deprecated namespaces, to be removed in v2.0.0
from . import windows

__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
'blackmanharris', 'flattop', 'bartlett', 'hanning', 'barthann',
'hamming', 'kaiser', 'gaussian', 'general_gaussian', 'general_cosine',
Expand Down
6 changes: 6 additions & 0 deletions scipy/sparse/__init__.py
Expand Up @@ -239,6 +239,12 @@
# For backward compatibility with v0.19.
from . import csgraph

# Deprecated namespaces, to be removed in v2.0.0
from . import (
base, bsr, compressed, construct, coo, csc, csr, data, dia, dok, extract,
lil, sparsetools, sputils
)

__all__ = [s for s in dir() if not s.startswith('_')]

# Filter PendingDeprecationWarning for np.matrix introduced with numpy 1.15
Expand Down
3 changes: 3 additions & 0 deletions scipy/spatial/__init__.py
Expand Up @@ -107,6 +107,9 @@
from ._procrustes import procrustes
from ._geometric_slerp import geometric_slerp

# Deprecated namespaces, to be removed in v2.0.0
from . import ckdtree, kdtree, qhull

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['distance', 'transform']

Expand Down
3 changes: 3 additions & 0 deletions scipy/spatial/transform/__init__.py
Expand Up @@ -19,6 +19,9 @@
from ._rotation import Rotation, Slerp
from ._rotation_spline import RotationSpline

# Deprecated namespaces, to be removed in v2.0.0
from . import rotation

__all__ = ['Rotation', 'Slerp', 'RotationSpline']

from scipy._lib._testutils import PytestTester
Expand Down
3 changes: 3 additions & 0 deletions scipy/special/__init__.py
Expand Up @@ -665,6 +665,9 @@
spherical_kn
)

# Deprecated namespaces, to be removed in v2.0.0
from . import add_newdocs, basic, orthogonal, specfun, sf_error, spfun_stats

__all__ = _ufuncs.__all__ + _basic.__all__ + _orthogonal.__all__ + [
'SpecialFunctionWarning',
'SpecialFunctionError',
Expand Down
5 changes: 5 additions & 0 deletions scipy/stats/__init__.py
Expand Up @@ -465,6 +465,11 @@
from ._page_trend_test import page_trend_test
from ._mannwhitneyu import mannwhitneyu

# Deprecated namespaces, to be removed in v2.0.0
from . import (
biasedurn, kde, morestats, mstats_basic, mstats_extras, mvn, statlib, stats
)

__all__ = [s for s in dir() if not s.startswith("_")] # Remove dunders.

from scipy._lib._testutils import PytestTester
Expand Down

0 comments on commit 7b3d947

Please sign in to comment.