Skip to content

Commit dfec19c

Browse files
authored
remove submodule imports redundant with __getattr__ (#599)
* remove submodule imports redundant with __getattr__ * Retrigger CI
1 parent eb5d194 commit dfec19c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

zenoh/__init__.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@
1313
#
1414
from .zenoh import *
1515

16-
try:
17-
from . import ext
18-
except ImportError:
19-
pass
20-
try:
21-
from . import shm
22-
except ImportError:
23-
pass
24-
2516

2617
def __getattr__(name):
2718
if name == "ext":
2819
import zenoh.ext
20+
21+
return zenoh.ext
2922
elif name == "shm":
3023
import zenoh.shm
24+
25+
return zenoh.shm
26+
27+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)