Skip to content

Commit

Permalink
Fix ma namespaces (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha authored Oct 23, 2024
1 parent bbc5c02 commit c964f16
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/foapy/ma/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys

# We first need to detect if we're being called as part of the numpy setup
# procedure itself in a reliable manner.
try:
__FOAPY_SETUP__
except NameError:
__FOAPY_SETUP__ = False

if __FOAPY_SETUP__:
sys.stderr.write("Running from numpy source directory.\n")
else:
from .alphabet import alphabet # noqa: F401
from .intervals import intervals # noqa: F401
from .order import order # noqa: F401

__all__ = list({"order", "intervals", "alphabet"})
2 changes: 1 addition & 1 deletion src/foapy/ma/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from foapy import order as general_order
from foapy.exceptions import Not1DArrayException
from foapy.ma.alphabet import alphabet
from foapy.ma import alphabet


def order(X, return_alphabet=False) -> np.ma.MaskedArray:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ma_alphabet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from numpy.ma.testutils import assert_equal

from foapy.exceptions import InconsistentOrderException, Not1DArrayException
from foapy.ma.alphabet import alphabet
from foapy.ma import alphabet


class TestMaAlphabet(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ma_intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from numpy.ma.testutils import assert_equal

from foapy.exceptions import InconsistentOrderException, Not1DArrayException
from foapy.ma.intervals import intervals
from foapy.ma import intervals


class TestMaIntervals(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ma_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from numpy.ma.testutils import assert_equal

from foapy.exceptions import InconsistentOrderException, Not1DArrayException
from foapy.ma.order import order
from foapy.ma import order


class TestMaOrder(TestCase):
Expand Down

0 comments on commit c964f16

Please sign in to comment.