fix module leaking for real

This commit is contained in:
Connor Olding 2018-03-13 03:27:11 +01:00
parent 843524b80a
commit ec71d4956e
3 changed files with 6 additions and 4 deletions

View file

@ -22,6 +22,5 @@ from .weight import *
# this is similar to default behaviour of having no __all__ variable at all,
# but ours ignores modules as well. this allows for `import sys` and such
# without clobbering `from our_module import *`.
__all__ = [
o for o in locals()
if type(o) != 'module' and not o.startswith('_')]
__all__ = [k for k, v in locals().items()
if not __import__('inspect').ismodule(v) and not k.startswith('_')]

View file

@ -1,3 +1,5 @@
import numpy as np
from .float import *
from .layer import Layer
from .loss import Loss

View file

@ -17,4 +17,5 @@ _sqrt2 = _f(np.sqrt(2))
_invsqrt2 = _f(1/np.sqrt(2))
_pi = _f(np.pi)
__all__ = [o for o in locals() if type(o) != 'module']
__all__ = [k for k, v in locals().items()
if not __import__('inspect').ismodule(v)]