Skip to content

Commit

Permalink
Put __all__ amendments last in __init__.py files
Browse files Browse the repository at this point in the history
  • Loading branch information
kohr-h committed Apr 2, 2020
1 parent 002fc6f commit 4668dd5
Show file tree
Hide file tree
Showing 23 changed files with 110 additions and 166 deletions.
8 changes: 4 additions & 4 deletions odl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
# Import all names from "core" subpackages into the top-level namespace;
# the `__all__` collection is extended later to make import errors more
# visible (otherwise one gets errors like "... has no attribute __all__")
from .discr import *
from .operator import *
from .set import *
from .space import *
from .operator import *
from .discr import *

# More "advanced" subpackages keep their namespaces separate from top-level,
# we only import the modules themselves
Expand All @@ -74,9 +74,9 @@
from .util import test

# Amend `__all__`
__all__ += discr.__all__
__all__ += operator.__all__
__all__ += set.__all__
__all__ += space.__all__
__all__ += operator.__all__
__all__ += discr.__all__
__all__ += ('test',)
__all__ += ('ufunc_ops', 'ufunc_funcs')
6 changes: 3 additions & 3 deletions odl/_ufunc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2019 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,7 +10,7 @@

from __future__ import absolute_import

__all__ = ()

from ._ufunc_ops import ufunc_ops, ufunc_funcs

__all__ = ()
__all__ += ('ufunc_ops', 'ufunc_funcs')
8 changes: 3 additions & 5 deletions odl/deform/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

"""Operators and functions for linearized deformations in ODL."""
"""Operators and functions for deformations."""

from __future__ import absolute_import

from .linearized import *

__all__ = ()


from .linearized import *
__all__ += linearized.__all__
2 changes: 1 addition & 1 deletion odl/discr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

from __future__ import absolute_import

from . import discr_utils
from .diff_ops import *
from .discr_ops import *
from .discr_space import *
from .grid import *
from .partition import *
from . import discr_utils

__all__ = ()

Expand Down
18 changes: 7 additions & 11 deletions odl/operator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2019 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,19 +10,15 @@

from __future__ import absolute_import

__all__ = ()

from .default_ops import *
from .operator import *
__all__ += operator.__all__
from .oputils import *
from .pspace_ops import *
from .tensor_ops import *

from .default_ops import *
__all__ = ()
__all__ += operator.__all__
__all__ += default_ops.__all__

from .pspace_ops import *
__all__ += pspace_ops.__all__

from .tensor_ops import *
__all__ += tensor_ops.__all__

from .oputils import *
__all__ += oputils.__all__
19 changes: 7 additions & 12 deletions odl/phantom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2018 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,21 +10,16 @@

from __future__ import absolute_import

__all__ = ()

from . import phantom_utils

from .emission import *
__all__ += emission.__all__

from .geometric import *
__all__ += geometric.__all__

from .misc_phantoms import *
__all__ += misc_phantoms.__all__

from .noise import *
__all__ += noise.__all__

from .transmission import *

__all__ = ()
__all__ += emission.__all__
__all__ += geometric.__all__
__all__ += misc_phantoms.__all__
__all__ += noise.__all__
__all__ += transmission.__all__
12 changes: 5 additions & 7 deletions odl/set/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2019 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,13 +10,11 @@

from __future__ import absolute_import

__all__ = ()

from .domain import *
from .sets import *
__all__ += sets.__all__
from .space import *

from .domain import *
__all__ = ()
__all__ += sets.__all__
__all__ += domain.__all__

from .space import *
__all__ += space.__all__
18 changes: 7 additions & 11 deletions odl/solvers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -8,20 +8,16 @@

from __future__ import absolute_import

from .functional import *
from .iterative import *
from .nonsmooth import *
from .smooth import *
from .util import *

__all__ = ()

from .functional import *
__all__ += functional.__all__

from .nonsmooth import *
__all__ += iterative.__all__
__all__ += nonsmooth.__all__

from .smooth import *
__all__ += smooth.__all__

from .iterative import *
__all__ += iterative.__all__

from .util import *
__all__ += util.__all__
15 changes: 6 additions & 9 deletions odl/solvers/functional/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -8,16 +8,13 @@

from __future__ import absolute_import

__all__ = ()

from .default_functionals import *
from .derivatives import *
from .example_funcs import *
from .functional import *
__all__ += functional.__all__

from .default_functionals import *
__all__ = ()
__all__ += functional.__all__
__all__ += default_functionals.__all__

from .example_funcs import *
__all__ += example_funcs.__all__

from .derivatives import *
__all__ += derivatives.__all__
9 changes: 4 additions & 5 deletions odl/solvers/iterative/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,10 +10,9 @@

from __future__ import absolute_import

__all__ = ()

from .iterative import *
__all__ += iterative.__all__

from .statistical import *

__all__ = ()
__all__ += iterative.__all__
__all__ += statistical.__all__
29 changes: 11 additions & 18 deletions odl/solvers/nonsmooth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,21 @@

from __future__ import absolute_import

__all__ = ()

from .proximal_operators import *
__all__ += proximal_operators.__all__

from .admm import *
__all__ += admm.__all__

from .primal_dual_hybrid_gradient import *
__all__ += primal_dual_hybrid_gradient.__all__

from .alternating_dual_updates import *
from .difference_convex import *
from .douglas_rachford import *
__all__ += douglas_rachford.__all__

from .forward_backward import *
__all__ += forward_backward.__all__

from .primal_dual_hybrid_gradient import *
from .proximal_gradient_solvers import *
__all__ += proximal_gradient_solvers.__all__
from .proximal_operators import *

from .alternating_dual_updates import *
__all__ = ()
__all__ += admm.__all__
__all__ += alternating_dual_updates.__all__

from .difference_convex import *
__all__ += difference_convex.__all__
__all__ += douglas_rachford.__all__
__all__ += forward_backward.__all__
__all__ += primal_dual_hybrid_gradient.__all__
__all__ += proximal_gradient_solvers.__all__
__all__ += proximal_operators.__all__
12 changes: 5 additions & 7 deletions odl/solvers/smooth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -10,13 +10,11 @@

from __future__ import absolute_import

__all__ = ()

from .gradient import *
__all__ += gradient.__all__

from .newton import *
__all__ += newton.__all__

from .nonlinear_cg import *

__all__ = ()
__all__ += gradient.__all__
__all__ += newton.__all__
__all__ += nonlinear_cg.__all__
9 changes: 4 additions & 5 deletions odl/solvers/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -8,10 +8,9 @@

from __future__ import absolute_import

__all__ = ()

from .callback import *
__all__ += callback.__all__

from .steplen import *

__all__ = ()
__all__ += callback.__all__
__all__ += steplen.__all__
14 changes: 5 additions & 9 deletions odl/space/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@

from __future__ import absolute_import

__all__ = ()

from . import base_tensors
from . import entry_points

from . import base_tensors, entry_points
from .npy_tensors import *
__all__ += npy_tensors.__all__

from .pspace import *
__all__ += pspace.__all__

from .space_utils import *

__all__ = ()
__all__ += npy_tensors.__all__
__all__ += pspace.__all__
__all__ += space_utils.__all__
20 changes: 8 additions & 12 deletions odl/tomo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2017 The ODL contributors
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
Expand All @@ -8,23 +8,19 @@

"""Tomography related operators and geometries."""


from __future__ import absolute_import

__all__ = ()

from .geometry import *
__all__ += geometry.__all__

from .operators import *
__all__ += operators.__all__

from .analytic import *
__all__ += analytic.__all__

from .backends import (
ASTRA_AVAILABLE, ASTRA_CUDA_AVAILABLE, SKIMAGE_AVAILABLE,
astra_conebeam_2d_geom_to_vec, astra_conebeam_3d_geom_to_vec)
from .geometry import *
from .operators import *

__all__ = ()
__all__ += analytic.__all__
__all__ += geometry.__all__
__all__ += operators.__all__
__all__ += (
'ASTRA_AVAILABLE',
'ASTRA_CUDA_AVAILABLE',
Expand Down
Loading

0 comments on commit 4668dd5

Please sign in to comment.