Skip to content

Commit 2169dc2

Browse files
committed
Add additional math methods.
1 parent e3ceaa5 commit 2169dc2

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

crates/processing_pyo3/mewnala/__init__.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
from .mewnala import *
22

3-
# re-export the native submodules as submodules of this module, if they exist
4-
# this allows users to import from `mewnala.math` and `mewnala.color`
5-
# if they exist, without needing to know about the internal structure of the native module
63
import sys as _sys
74
from . import mewnala as _native
8-
for _name in ("math", "color"):
9-
_sub = getattr(_native, _name, None)
10-
if _sub is not None:
11-
_sys.modules[f"{__name__}.{_name}"] = _sub
5+
6+
_color = getattr(_native, "color", None)
7+
if _color is not None:
8+
_sys.modules[f"{__name__}.color"] = _color
9+
10+
from . import math # noqa: E402 (Python submodule, extends native math)
11+
from .math import * # noqa: E402,F401,F403
1212

1313
# global var handling. for wildcard import of our module, we copy into globals, otherwise
14-
# we dispatch to get attr and call the underlying getter method
14+
# we dispatch to get attr and call the underlying getter method
1515

1616
_DYNAMIC_GRAPHICS_ATTRS = (
1717
"width",
@@ -69,6 +69,3 @@ def __getattr__(name):
6969

7070
def __dir__():
7171
return sorted(set(list(globals().keys()) + list(_DYNAMIC)))
72-
73-
74-
del _sys, _name, _sub

0 commit comments

Comments
 (0)