cdxcore 0.1.14__py3-none-any.whl → 0.1.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cdxcore might be problematic. Click here for more details.

docs/source/conf.py CHANGED
@@ -31,7 +31,7 @@ extensions = [
31
31
  "sphinx.ext.autosummary",
32
32
  "sphinx.ext.intersphinx",
33
33
  "sphinx.ext.viewcode",
34
- #"sphinx_autodoc_typehints",
34
+ "sphinx_autodoc_typehints",
35
35
  "numpydoc",
36
36
  "sphinx_automodapi.automodapi",
37
37
  "sphinx_copybutton",
@@ -68,7 +68,6 @@ autodoc_default_options = {
68
68
  "special-members": "__call__"
69
69
  }
70
70
  autodoc_typehints = 'signature' # types shown in the doc body, like NumPy
71
- #numpydoc_show_class_members = True
72
71
 
73
72
  # numpydoc tweaks (keeps class doc at top, avoids member spam)
74
73
  numpydoc_show_class_members = True
@@ -116,8 +115,4 @@ def setup(app):
116
115
  app.add_role_to_domain("py", "dec", PyXRefRole("func"))
117
116
  return {"parallel_read_safe": True}
118
117
 
119
- #def setup(app):
120
- # app.add_role("dec", decorator_role)
121
- # return {"parallel_read_safe": True}
122
-
123
118
 
tests/test_deferred.py CHANGED
@@ -23,7 +23,7 @@ def import_local():
23
23
  sys.path.insert( 0, cwd[:-6] )
24
24
  import_local()
25
25
 
26
- from cdxcore.deferred import Deferred, ResolutionDependencyError
26
+ from cdxcore.deferred import Deferred, ResolutionDependencyError, NotSupportedError
27
27
 
28
28
  class qB(object):
29
29
  def __init__(self):
@@ -150,7 +150,7 @@ class Test(unittest.TestCase):
150
150
  deferred_b.deferred_resolve( qA() )
151
151
  deferred_a.deferred_resolve( qA() )
152
152
 
153
- results_tst = { k: v.deferred_action_result for k,v in results_drf.items() }
153
+ results_tst = { k: v.deferred_result for k,v in results_drf.items() }
154
154
 
155
155
  self.assertEqual( list(results_tst), list(results_act) )
156
156
  for k, tst in results_tst.items():
@@ -241,7 +241,7 @@ class Test(unittest.TestCase):
241
241
  deferred_a.deferred_resolve( np.full((4,2),3,dtype=np.int32) )
242
242
 
243
243
  results_act = { k: v.astype(np.int32) for k,v in results_act.items() }
244
- results_tst = { k: v.deferred_action_result.astype(np.int32) for k,v in results_drf.items() }
244
+ results_tst = { k: v.deferred_result.astype(np.int32) for k,v in results_drf.items() }
245
245
 
246
246
  self.assertEqual( list(results_tst), list(results_act) )
247
247
  for k, tst in results_tst.items():
@@ -249,6 +249,26 @@ class Test(unittest.TestCase):
249
249
  self.assertEqual( act.shape, tst.shape, msg=k )
250
250
  self.assertTrue( np.all( tst == act ), msg=f"Step 2 {k} '{tst}' != '{act}'" )
251
251
 
252
+ # abs
253
+
254
+ a = Deferred("a")
255
+ b = abs(a)
256
+ a.deferred_resolve(int(-11))
257
+ self.assertEqual( b.deferred_result, 11 )
258
+
259
+ # unsupported
260
+
261
+ with self.assertRaises(NotSupportedError):
262
+ a = Deferred("a")
263
+ bool(a)
264
+ with self.assertRaises(NotSupportedError):
265
+ a = Deferred("a")
266
+ a.__index__()
267
+ a = Deferred("a")
268
+ a = abs(a)*3
269
+ self.assertEqual(str(a), "(|$a|*3)" )
270
+ self.assertEqual(repr(a), "DeferredAction[(|$a|*3) <- $a]" )
271
+
252
272
  # info test
253
273
 
254
274
  a = Deferred("a")