Skip to content

Commit

Permalink
remove redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
Beforerr committed Nov 1, 2024
1 parent a618f66 commit 5212571
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pyspedas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,11 @@
# like "from pyspedas.mms import mec" even after mms has been moved to the projects directory.

from importlib import import_module
from .projects import submodules as projects_submodules

# List of submodules we want to make available under the pyspedas namespace
submodules = ['ace', 'akebono', 'barrel', 'cluster', 'cnofs', 'csswe', 'de2', 'dscovr',
'elfin', 'equator_s', 'erg', 'fast', 'geotail', 'goes', 'image', 'kompsat',
'kyoto', 'lanl', 'maven', 'mica', 'mms', 'noaa', 'omni', 'poes', 'polar', 'psp',
'rbsp', 'secs', 'soho', 'solo', 'st5', 'stereo', 'swarm', 'themis', 'themis.state', 'twins',
'ulysses', "wind"
]

# Make project submodules available under the pyspedas namespace
def __getattr__(name):
if name in submodules:
if name in projects_submodules:
return import_module(".projects." + name, __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Expand Down
1 change: 1 addition & 0 deletions pyspedas/projects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"themis.state",
"twins",
"ulysses",
"wind",
]

__getattr__, __dir__, _ = lazy.attach(__name__, submodules)

0 comments on commit 5212571

Please sign in to comment.