Cleaner openmc.deplete namespace with __all__

Provide explicit __all__ lists for files in openmc/deplete
containing classes that should be brought into the "primary"
API. This prevents cluttering the openmc.deplete namespace
caused by the wildcard imports
```
from .nuclide import *
...
```

The abc, cram, and helpers modules are imported simply as
```
from . import abc
from . import cram
from . import helpers
```
This commit is contained in:
Andrew Johnson 2019-09-17 15:13:19 -05:00
parent 72471d249f
commit b3c5d98454
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
9 changed files with 29 additions and 3 deletions

View file

@ -35,7 +35,10 @@ from .nuclide import *
from .chain import *
from .operator import *
from .reaction_rates import *
from .abc import *
from .atom_number import *
from .results import *
from .results_list import *
from .integrators import *
from . import abc
from . import cram
from . import helpers

View file

@ -24,6 +24,13 @@ from .results import Results
from .chain import Chain
from .results_list import ResultsList
__all__ = [
"OperatorResult", "TransportOperator", "ReactionRateHelper",
"EnergyHelper", "FissionYieldHelper", "TalliedFissionYieldHelper",
"Integrator", "SIIntegrator"]
OperatorResult = namedtuple('OperatorResult', ['k', 'rates'])
OperatorResult.__doc__ = """\
Result of applying transport operator

View file

@ -45,6 +45,8 @@ _REACTIONS = [
]
__all__ = ["Chain"]
def replace_missing(product, decay_data):
"""Replace missing product with suitable decay daughter.

View file

@ -13,8 +13,6 @@ import scipy.sparse.linalg as sla
from . import comm
__all__ = ["deplete", "timed_deplete", "CRAM16", "CRAM48"]
def deplete(chain, x, rates, dt, matrix_func=None):
"""Deplete materials using given reaction rates for a specified time

View file

@ -17,6 +17,10 @@ from numpy import empty
from openmc.checkvalue import check_type
__all__ = [
"DecayTuple", "ReactionTuple", "Nuclide", "FissionYield",
"FissionYieldDistribution"]
DecayTuple = namedtuple('DecayTuple', 'type target branching_ratio')
DecayTuple.__doc__ = """\

View file

@ -30,6 +30,9 @@ from .helpers import (
FissionYieldCutoffHelper, AveragedFissionYieldHelper)
__all__ = ["Operator", "OperatorResult"]
def _distribute(items):
"""Distribute items across MPI communicator

View file

@ -7,6 +7,9 @@ from collections import OrderedDict
import numpy as np
__all__ = ["ReactionRates"]
class ReactionRates(np.ndarray):
"""Reaction rates resulting from a transport operator call

View file

@ -16,6 +16,9 @@ from .reaction_rates import ReactionRates
_VERSION_RESULTS = (1, 0)
__all__ = ["Results"]
class Results(object):
"""Output of a depletion run

View file

@ -5,6 +5,9 @@ from .results import Results, _VERSION_RESULTS
from openmc.checkvalue import check_filetype_version
__all__ = ["ResultsList"]
class ResultsList(list):
"""A list of openmc.deplete.Results objects