Skip to content

Relocate dynamic propagation of registry to Python namespaces #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions dynd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@
'__libdynd_version__', '__version__', '__libdynd_git_sha1__', '__git_sha1__',
'annotate', 'test', 'load'
]

from .nd.registry import propagate_all

propagate_all()
8 changes: 6 additions & 2 deletions dynd/nd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
parse_json, squeeze, dtype_of, old_linspace, fields, ndim_of
from .callable import callable

from . import functional

from .registry import propagate_all

propagate_all()

inf = float('inf')
nan = float('nan')

from . import functional
11 changes: 11 additions & 0 deletions dynd/nd/test/test_callable_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import unittest
# import nd to ensure that the callable type is registered at all.
from dynd import nd, ndt

class TestCallableType(unittest.TestCase):

def test_callable(self):
tp = ndt.callable(ndt.void, ndt.int32, ndt.float64, x = ndt.complex128)

def test_callable_type(self):
tp = ndt.callable(ndt.int32, ndt.float64)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
from dynd import ndt
# import nd to make sure the types are propagated out of the registry.
from dynd import ndt, nd

class TestTypeBasics(unittest.TestCase):
def test_type_repr(self):
Expand Down
6 changes: 0 additions & 6 deletions dynd/ndt/test/test_dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ def test_tuple(self):
def test_struct(self):
tp = ndt.struct(x = ndt.int32, y = ndt.float64)

def test_callable(self):
tp = ndt.callable(ndt.void, ndt.int32, ndt.float64, x = ndt.complex128)

class TestTypeFor(unittest.TestCase):
def test_bool(self):
self.assertEqual(ndt.bool, ndt.type_for(True))
Expand Down Expand Up @@ -182,9 +179,6 @@ def test_fixed_bytes_type(self):
def test_cstruct_type(self):
self.assertFalse(ndt.type('{x: int32}') == ndt.type('{y: int32}'))

def test_callable_type(self):
tp = ndt.callable(ndt.int32, ndt.float64)

def test_struct_type(self):
tp = ndt.make_struct([ndt.int32, ndt.int64], ['x', 'y'])
self.assertTrue(tp.field_types, [ndt.int32, ndt.int64])
Expand Down