cdxcore 0.1.10__py3-none-any.whl → 0.1.13__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.
- cdxcore/__init__.py +1 -1
- cdxcore/crman.py +4 -1
- cdxcore/deferred.py +752 -0
- cdxcore/err.py +10 -5
- cdxcore/jcpool.py +337 -106
- cdxcore/subdir.py +1 -1
- cdxcore/util.py +72 -1
- cdxcore/verbose.py +15 -1
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/METADATA +1 -1
- cdxcore-0.1.13.dist-info/RECORD +37 -0
- tests/test_config.py +1 -11
- tests/test_crman.py +2 -13
- tests/test_deferred.py +277 -0
- tests/test_err.py +2 -10
- tests/test_jcpool.py +185 -0
- tests/test_pretty.py +2 -12
- tests/test_subdir.py +1 -9
- tests/test_uniquehash.py +1 -9
- tests/test_util.py +100 -10
- tests/test_verbose.py +1 -10
- tests/test_version.py +1 -9
- cdxcore-0.1.10.dist-info/RECORD +0 -35
- tmp/deferred.py +0 -220
- {tmp → cdxcore}/dynaplot.py +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/WHEEL +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/licenses/LICENSE +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/top_level.txt +0 -0
cdxcore/err.py
CHANGED
|
@@ -95,6 +95,11 @@ def _fmt( text : str, args = None, kwargs = None, f : Callable = None ) -> str:
|
|
|
95
95
|
return text % tuple(args)
|
|
96
96
|
except TypeError as e:
|
|
97
97
|
raise TypeError(e, text, args)
|
|
98
|
+
|
|
99
|
+
# no keyword arguments --> must be plain text
|
|
100
|
+
if kwargs is None:
|
|
101
|
+
return text
|
|
102
|
+
|
|
98
103
|
# text
|
|
99
104
|
# python 2 and 3 mode
|
|
100
105
|
kwargs = dict() if kwargs is None else kwargs
|
|
@@ -117,7 +122,7 @@ def fmt(text : str|Callable, * args, ** kwargs) -> str:
|
|
|
117
122
|
one = 1
|
|
118
123
|
fmt(lambda : f"one {one:d}) # using a lambda function
|
|
119
124
|
fmt("one {one:d}", one=one) # using python 3 string.format()
|
|
120
|
-
fmt("one %
|
|
125
|
+
fmt("one %(one)ld", one=one) # using python 2 style
|
|
121
126
|
fmt("one %ld", one) # using c-style
|
|
122
127
|
|
|
123
128
|
As shown, do not use f-strings directly as they are immediately executed in the scope they are typed in
|
|
@@ -164,7 +169,7 @@ def error( text : str|Callable, *args, exception : Exception = RuntimeError, **k
|
|
|
164
169
|
one = 1
|
|
165
170
|
error(lambda : f"one {one:d}") # wrapped f-string
|
|
166
171
|
error("one {one:d}", one=one) # using python 3 string.format()
|
|
167
|
-
error("one %
|
|
172
|
+
error("one %(one)ld", one=one) # using python 2 style
|
|
168
173
|
error("one %ld", one) # using c-style
|
|
169
174
|
|
|
170
175
|
As shown, do not use f-strings directly as they are immediately executed in the scope they are typed in
|
|
@@ -214,7 +219,7 @@ def verify( cond : bool, text : str|Callable, *args, exception : Exception = Run
|
|
|
214
219
|
good = False # some condition
|
|
215
220
|
verify(good, lambda : f"one {one:d}") # wrapped f-string
|
|
216
221
|
verify(good, "one {one:d}", one=one) # using python 3 string.format()
|
|
217
|
-
verify(good, "one %
|
|
222
|
+
verify(good, "one %(one)ld", one=one) # using python 2 style
|
|
218
223
|
verify(good, "one %ld", one) # using c-style
|
|
219
224
|
|
|
220
225
|
As shown, do not use f-strings directly as they are immediately executed in the scope they are typed in
|
|
@@ -268,7 +273,7 @@ def warn( text : str|Callable, *args, warning = RuntimeWarning, stack_level : in
|
|
|
268
273
|
one = 1
|
|
269
274
|
warn(lambda : f"one {one:d}") # wrapped f-string
|
|
270
275
|
warn("one {one:d}", one=one) # using python 3 string.format()
|
|
271
|
-
warn("one %
|
|
276
|
+
warn("one %(one)ld", one=one) # using python 2 style
|
|
272
277
|
warn("one %ld", one) # using c-style
|
|
273
278
|
|
|
274
279
|
As shown, do not use f-strings directly as they are immediately executed in the scope they are typed in
|
|
@@ -322,7 +327,7 @@ def warn_if( cond : bool, text : str|Callable, *args, warning = RuntimeWarning,
|
|
|
322
327
|
bad = True # some conditon
|
|
323
328
|
warn_if(bad,lambda : f"one {one:d}") # wrapped f-string
|
|
324
329
|
warn_if(bad,"one {one:d}", one=one) # using python 3 string.format()
|
|
325
|
-
warn_if(bad,"one %
|
|
330
|
+
warn_if(bad,"one %(one)ld", one=one) # using python 2 style
|
|
326
331
|
warn_if(bad,"one %ld", one) # using c-style
|
|
327
332
|
|
|
328
333
|
As shown, do not use f-strings directly as they are immediately executed in the scope they are typed in
|