Skip to content

Commit 79733fb

Browse files
committed
fixed #737 : cleanup modules namespaces
1 parent d1f9808 commit 79733fb

22 files changed

+100
-122
lines changed

larray/__init__.py

Lines changed: 93 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,97 @@
11
from __future__ import absolute_import, division, print_function
22

3-
from larray.core import *
4-
from larray.inout import *
5-
from larray.util import *
6-
from larray.example import *
7-
from larray.extra import *
8-
from larray.viewer import *
3+
__version__ = '0.30-dev'
4+
5+
6+
from larray.core.axis import Axis, AxisCollection, X
7+
from larray.core.group import Group, LGroup, LSet, IGroup, union
8+
from larray.core.array import (LArray, zeros, zeros_like, ones, ones_like, empty, empty_like, full,
9+
full_like, sequence, labels_array, ndtest, aslarray, identity, diag,
10+
eye, all, any, sum, prod, cumsum, cumprod, min, max, mean, ptp, var,
11+
std, median, percentile, stack)
12+
from larray.core.session import Session, local_arrays, global_arrays, arrays
13+
from larray.core.constants import nan, inf, pi, e, euler_gamma
14+
from larray.core.metadata import Metadata
15+
from larray.core.ufuncs import maximum, minimum, where
16+
from larray.core.npufuncs import (sin, cos, tan, arcsin, arccos, arctan, hypot, arctan2, degrees,
17+
radians, unwrap, sinh, cosh, tanh, arcsinh, arccosh, arctanh,
18+
angle, real, imag, conj,
19+
round, around, round_, rint, fix, floor, ceil, trunc,
20+
exp, expm1, exp2, log, log10, log2, log1p, logaddexp, logaddexp2,
21+
i0, sinc, signbit, copysign, frexp, ldexp,
22+
convolve, clip, sqrt, absolute, fabs, sign, fmax, fmin, nan_to_num,
23+
real_if_close, interp, isnan, isinf, inverse)
24+
25+
from larray.inout.misc import from_lists, from_string
26+
from larray.inout.pandas import from_frame, from_series
27+
from larray.inout.csv import read_csv, read_tsv, read_eurostat
28+
from larray.inout.excel import read_excel
29+
from larray.inout.hdf import read_hdf
30+
from larray.inout.sas import read_sas
31+
from larray.inout.xw_excel import open_excel, Workbook
32+
33+
from larray.viewer import view, edit, compare
34+
35+
from larray.extra.ipfp import ipfp
36+
37+
from larray.example import get_example_filepath, load_example_data
38+
939
import larray.random
1040

11-
__version__ = '0.30-dev'
41+
42+
__all__ = [
43+
# axis
44+
'Axis', 'AxisCollection', 'X',
45+
# group
46+
'Group', 'LGroup', 'LSet', 'IGroup', 'union',
47+
# array
48+
'LArray', 'zeros', 'zeros_like', 'ones', 'ones_like', 'empty', 'empty_like', 'full',
49+
'full_like', 'sequence', 'labels_array', 'ndtest', 'aslarray', 'identity', 'diag', 'eye',
50+
'all', 'any', 'sum', 'prod', 'cumsum', 'cumprod', 'min', 'max', 'mean', 'ptp', 'var', 'std',
51+
'median', 'percentile', 'stack',
52+
# session
53+
'Session', 'local_arrays', 'global_arrays', 'arrays',
54+
# constants
55+
'nan', 'inf', 'pi', 'e', 'euler_gamma',
56+
# metadata
57+
'Metadata',
58+
# ufuncs
59+
'maximum', 'minimum', 'where',
60+
'sin', 'cos', 'tan', 'arcsin', 'arccos', 'arctan', 'hypot', 'arctan2', 'degrees', 'radians',
61+
'unwrap', 'sinh', 'cosh', 'tanh', 'arcsinh', 'arccosh', 'arctanh',
62+
'angle', 'real', 'imag', 'conj',
63+
'round', 'around', 'round_', 'rint', 'fix', 'floor', 'ceil', 'trunc',
64+
'exp', 'expm1', 'exp2', 'log', 'log10', 'log2', 'log1p', 'logaddexp', 'logaddexp2',
65+
'i0', 'sinc', 'signbit', 'copysign', 'frexp', 'ldexp',
66+
'convolve', 'clip', 'sqrt', 'absolute', 'fabs', 'sign', 'fmax', 'fmin', 'nan_to_num',
67+
'real_if_close', 'interp', 'isnan', 'isinf', 'inverse',
68+
# inout
69+
'from_lists', 'from_string', 'from_frame', 'from_series', 'read_csv', 'read_tsv',
70+
'read_eurostat', 'read_excel', 'read_hdf', 'read_sas', 'open_excel', 'Workbook',
71+
# viewer
72+
'view', 'edit', 'compare',
73+
# ipfp
74+
'ipfp',
75+
# example
76+
'get_example_filepath', 'load_example_data',
77+
]
78+
79+
80+
# ==== DEPRECATED API ====
81+
82+
from larray.core.axis import x
83+
from larray.core.group import PGroup
84+
from larray.core.array import (create_sequential, ndrange, larray_equal, larray_nan_equal,
85+
nan_equal, element_equal)
86+
87+
88+
_deprecated = [
89+
# axis
90+
'x',
91+
# group
92+
'PGroup',
93+
# array
94+
'create_sequential', 'ndrange', 'larray_equal', 'larray_nan_equal', 'nan_equal', 'element_equal',
95+
]
96+
97+
__all__ += _deprecated

larray/core/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
from __future__ import absolute_import, division, print_function
2-
3-
from larray.core.constants import *
4-
from larray.core.group import *
5-
from larray.core.axis import *
6-
from larray.core.array import *
7-
from larray.core.session import *
8-
from larray.core.ufuncs import *
9-
from larray.core.npufuncs import *
10-
from larray.core.metadata import *

larray/core/array.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@
6767
renamed_to, deprecate_kwarg, LHDFStore, lazy_attribute)
6868

6969

70-
_deprecated = ['create_sequential', 'ndrange', 'larray_equal', 'larray_nan_equal', 'nan_equal', 'element_equal']
71-
72-
__all__ = [
73-
'LArray', 'zeros', 'zeros_like', 'ones', 'ones_like', 'empty', 'empty_like', 'full', 'full_like', 'sequence',
74-
'labels_array', 'ndtest', 'aslarray', 'identity', 'diag', 'eye', 'all', 'any', 'sum', 'prod', 'cumsum',
75-
'cumprod', 'min', 'max', 'mean', 'ptp', 'var', 'std', 'median', 'percentile', 'stack',
76-
] + _deprecated
77-
78-
7970
def all(values, axis=None):
8071
"""
8172
Test whether all array elements along a given axis evaluate to True.
@@ -5335,7 +5326,7 @@ def eq(self, other, rtol=0, atol=0, nans_equal=False):
53355326
if not nans_equal:
53365327
return self == other
53375328
else:
5338-
from larray.core import isnan
5329+
from larray.core.npufuncs import isnan
53395330

53405331
def general_isnan(a):
53415332
if np.issubclass_(a.dtype.type, np.inexact):
@@ -6049,7 +6040,7 @@ def clip(self, a_min, a_max, out=None):
60496040
-----
60506041
If `a_min` and/or `a_max` are array_like, broadcast will occur between self, `a_min` and `a_max`.
60516042
"""
6052-
from larray.core import clip
6043+
from larray.core.npufuncs import clip
60536044
return clip(self, a_min, a_max, out)
60546045

60556046
@deprecate_kwarg('transpose', 'wide')

larray/core/axis.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
from larray.util.misc import (basestring, PY2, unicode, long, duplicates, array_lookup2, ReprString, index_by_id,
1919
renamed_to, common_type, LHDFStore, lazy_attribute, _isnoneslice)
2020

21-
_deprecated = ['x']
22-
23-
__all__ = ['Axis', 'AxisCollection', 'X'] + _deprecated
24-
2521

2622
class Axis(ABCAxis):
2723
"""

larray/core/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import numpy as np
44

5-
__all__ = ['nan', 'inf', 'pi', 'e', 'euler_gamma']
65

76
nan = np.nan
87
r"NaN (Not a Number)"

larray/core/group.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
from larray.util.misc import (basestring, PY2, unique, find_closing_chr, _parse_bound, _seq_summary, _isintstring,
1616
renamed_to, LHDFStore)
1717

18-
_deprecated = ['PGroup']
19-
20-
__all__ = ['Group', 'LGroup', 'LSet', 'IGroup', 'union'] + _deprecated
21-
2218

2319
def _slice_to_str(key, repr_func=str):
2420
"""

larray/core/metadata.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
from larray.util.misc import PY2, basestring
66

77

8-
__all__ = ['Metadata']
9-
10-
118
if PY2:
129
class AttributeDict(object):
1310
def __init__(self, *args, **kwargs):

larray/core/npufuncs.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,6 @@
66
from larray.core.ufuncs import broadcastify
77

88

9-
__all__ = [
10-
# Trigonometric functions
11-
'sin', 'cos', 'tan', 'arcsin', 'arccos', 'arctan', 'hypot', 'arctan2', 'degrees', 'radians', 'unwrap',
12-
# 'deg2rad', 'rad2deg',
13-
14-
# Hyperbolic functions
15-
'sinh', 'cosh', 'tanh', 'arcsinh', 'arccosh', 'arctanh',
16-
17-
# Rounding
18-
'round', 'around', 'round_', 'rint', 'fix', 'floor', 'ceil', 'trunc',
19-
20-
# Sums, products, differences
21-
# 'prod', 'sum', 'nansum', 'cumprod', 'cumsum',
22-
23-
# cannot use a simple wrapped ufunc because those ufuncs do not preserve shape or dimensions so labels are wrong
24-
# 'diff', 'ediff1d', 'gradient', 'cross', 'trapz',
25-
26-
# Exponents and logarithms
27-
'exp', 'expm1', 'exp2', 'log', 'log10', 'log2', 'log1p', 'logaddexp', 'logaddexp2',
28-
29-
# Other special functions
30-
'i0', 'sinc',
31-
32-
# Floating point routines
33-
'signbit', 'copysign', 'frexp', 'ldexp',
34-
35-
# Arithmetic operations
36-
# 'add', 'reciprocal', 'negative', 'multiply', 'divide', 'power', 'subtract', 'true_divide', 'floor_divide',
37-
# 'fmod', 'mod', 'modf', 'remainder',
38-
39-
# Handling complex numbers
40-
'angle', 'real', 'imag', 'conj',
41-
42-
# Miscellaneous
43-
'convolve', 'clip', 'sqrt',
44-
# 'square',
45-
'absolute', 'fabs', 'sign', 'fmax', 'fmin', 'nan_to_num', 'real_if_close',
46-
'interp', 'isnan', 'isinf', 'inverse',
47-
]
48-
49-
509
# Trigonometric functions
5110

5211
sin = broadcastify(np.sin)

larray/core/ufuncs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from larray.core.array import LArray, raw_broadcastable
77

88

9-
__all__ = ['maximum', 'minimum', 'where']
10-
11-
129
def broadcastify(func):
1310
# intentionally not using functools.wraps, because it does not work for wrapping a function from another module
1411
def wrapper(*args, **kwargs):

larray/example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import larray as la
33

4-
__all__ = ['get_example_filepath', 'load_example_data']
54

65
EXAMPLE_FILES_DIR = os.path.dirname(__file__) + '/tests/data/'
76
AVAILABLE_EXAMPLE_DATA = {

0 commit comments

Comments
 (0)