Skip to content

Commit 4220ba1

Browse files
committed
Support star import
1 parent ced1b44 commit 4220ba1

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

julia/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def __init__(self, loader, *args, **kwargs):
5252
self.__julia = loader.julia
5353
self.__loader__ = loader
5454

55+
@property
56+
def __all__(self):
57+
juliapath = self.__name__.lstrip("julia.")
58+
names = set(self.__julia.eval("names({})".format(juliapath)))
59+
names.discard(juliapath.rsplit('.', 1)[-1])
60+
return list(names)
61+
5562
def __getattr__(self, name):
5663
juliapath = self.__name__.lstrip("julia.")
5764
attrname = name

test/_star_import.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from julia.Base.REPL import *

test/test_core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ def test_import_julia_submodule(self):
7878
from julia.Base import REPL
7979
assert isinstance(REPL, ModuleType)
8080

81+
def test_star_import_julia_module(self):
82+
from . import _star_import
83+
_star_import.BasicREPL
84+
8185
#TODO: this causes a segfault
8286
"""
8387
def test_import_julia_modules(self):

0 commit comments

Comments
 (0)