jolt 0.9.352__py3-none-any.whl → 0.9.354__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 jolt might be problematic. Click here for more details.
- jolt/tasks.py +15 -3
- jolt/version.py +1 -1
- {jolt-0.9.352.dist-info → jolt-0.9.354.dist-info}/METADATA +1 -1
- {jolt-0.9.352.dist-info → jolt-0.9.354.dist-info}/RECORD +7 -7
- {jolt-0.9.352.dist-info → jolt-0.9.354.dist-info}/WHEEL +0 -0
- {jolt-0.9.352.dist-info → jolt-0.9.354.dist-info}/entry_points.txt +0 -0
- {jolt-0.9.352.dist-info → jolt-0.9.354.dist-info}/top_level.txt +0 -0
jolt/tasks.py
CHANGED
|
@@ -136,7 +136,7 @@ class Parameter(object):
|
|
|
136
136
|
self.name = name
|
|
137
137
|
|
|
138
138
|
def __init__(self, default=None, values=None, required=True,
|
|
139
|
-
const=False, influence=True, help=None):
|
|
139
|
+
const=False, influence=True, help=None, valuesfn=None):
|
|
140
140
|
"""
|
|
141
141
|
Creates a new parameter.
|
|
142
142
|
|
|
@@ -144,6 +144,10 @@ class Parameter(object):
|
|
|
144
144
|
default (str, optional): An optional default value.
|
|
145
145
|
values (list, optional): A list of accepted values. An
|
|
146
146
|
assertion is raised if an unlisted value is assigned to the parameter.
|
|
147
|
+
valuesfn (func, optional); A function that validates the assigned value.
|
|
148
|
+
If both values and valuesfn are specified, the values list is validated
|
|
149
|
+
first. The function is passed the assigned value and should return.
|
|
150
|
+
boolean value. If the function returns False, a ParameterValueError is raised.
|
|
147
151
|
required (boolean, optional): If required, the parameter must be assigned
|
|
148
152
|
a value before the task can be executed. The default is ``True``.
|
|
149
153
|
const (boolean, optional): If const is True, the parameter is immutable
|
|
@@ -165,6 +169,7 @@ class Parameter(object):
|
|
|
165
169
|
self._default = default
|
|
166
170
|
self._value = default
|
|
167
171
|
self._accepted_values = values
|
|
172
|
+
self._accepted_values_fn = valuesfn
|
|
168
173
|
self._required = required
|
|
169
174
|
self._const = const
|
|
170
175
|
self._influence = influence
|
|
@@ -200,6 +205,8 @@ class Parameter(object):
|
|
|
200
205
|
def _validate(self, value, what=None):
|
|
201
206
|
if self._accepted_values is not None and value not in self._accepted_values:
|
|
202
207
|
raise ParameterValueError(self, value, what=what)
|
|
208
|
+
if self._accepted_values_fn is not None and not self._accepted_values_fn(value):
|
|
209
|
+
raise ParameterValueError(self, value, what=what)
|
|
203
210
|
|
|
204
211
|
def get_default(self):
|
|
205
212
|
""" Get the default value of the parameter.
|
|
@@ -437,7 +444,7 @@ class IntParameter(Parameter):
|
|
|
437
444
|
"""
|
|
438
445
|
|
|
439
446
|
def __init__(self, default=None, min=None, max=None, values=None, required=True, const=False,
|
|
440
|
-
influence=True, help=None):
|
|
447
|
+
influence=True, help=None, valuesfn=None):
|
|
441
448
|
"""
|
|
442
449
|
Creates a new parameter.
|
|
443
450
|
|
|
@@ -485,7 +492,8 @@ class IntParameter(Parameter):
|
|
|
485
492
|
required=required,
|
|
486
493
|
const=const,
|
|
487
494
|
influence=influence,
|
|
488
|
-
help=help
|
|
495
|
+
help=help,
|
|
496
|
+
valuesfn=valuesfn)
|
|
489
497
|
|
|
490
498
|
def _validate(self, value, what=None):
|
|
491
499
|
if self._min is not None and value < self._min:
|
|
@@ -689,6 +697,10 @@ class ListParameter(Parameter):
|
|
|
689
697
|
for item in value:
|
|
690
698
|
if item not in self._accepted_values:
|
|
691
699
|
raise ParameterValueError(self, item, what=what)
|
|
700
|
+
if self._accepted_values_fn is not None:
|
|
701
|
+
for item in value:
|
|
702
|
+
if not self._accepted_values_fn(item):
|
|
703
|
+
raise ParameterValueError(self, item, what=what)
|
|
692
704
|
|
|
693
705
|
def get_value(self):
|
|
694
706
|
return "+".join(self._value)
|
jolt/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.9.
|
|
1
|
+
__version__ = "0.9.354"
|
|
@@ -19,11 +19,11 @@ jolt/log.py,sha256=cqEfX__AWSA4onueTTdoL4HnovEtzT4yoRoyKQk2MH8,14592
|
|
|
19
19
|
jolt/manifest.py,sha256=T2-JPiXmYU4DNYTKLnDi1ywCufLYaIIAdoGWYrTL6V0,8529
|
|
20
20
|
jolt/options.py,sha256=P1uuxq7oJzlN4NTrZvj2NRH2CaVQObKy2DoETjwrBeA,434
|
|
21
21
|
jolt/scheduler.py,sha256=HRC8dAl9asI1exn7AUqBO0hbYzBlaSaGHgNqDlpQ72Q,21470
|
|
22
|
-
jolt/tasks.py,sha256=
|
|
22
|
+
jolt/tasks.py,sha256=D3X1XHnSuDDWAEis-Y6ULGIXTlLNCZTikLHZkbWEoII,114916
|
|
23
23
|
jolt/timer.py,sha256=PE-7vmsqZpF73e_cKSsrhd36-A7fJ9_XGYI_oBWJn5w,644
|
|
24
24
|
jolt/tools.py,sha256=_ijnN47sDFaEDhPMPIkLKcqGOewk2MLzvvyp3kuoask,79867
|
|
25
25
|
jolt/utils.py,sha256=6TphNzqr2AAQ55bGDD36YoJSi8qQM3FRkrY1iIkhtNA,18771
|
|
26
|
-
jolt/version.py,sha256=
|
|
26
|
+
jolt/version.py,sha256=ruUZkLP6OcnJLHZ_RG3VdNkwZgmNXEfjXx17Hh77w2U,24
|
|
27
27
|
jolt/version_utils.py,sha256=tNCGT6ZmSGFHW1aw2Hx1l19m-RR1UnTN6xJV1I54KRw,3900
|
|
28
28
|
jolt/xmldom.py,sha256=SbygiDUMYczzWGxXa60ZguWS6Nztg8gDAirdbtjT15I,5982
|
|
29
29
|
jolt/bin/fstree-darwin-x86_64,sha256=i4Ppbdr7CxsEhJzWpy3GMB5Gn5ikmskh41MyUwQS3-o,29549000
|
|
@@ -86,8 +86,8 @@ jolt/templates/cxxexecutable.cmake.template,sha256=f0dg1VOFlamlF8fuHFTki5dsJ2ssS
|
|
|
86
86
|
jolt/templates/cxxlibrary.cmake.template,sha256=GMEG2G3QoY3E5fsNer52zOqgM221-abeCkV__mVbZ94,1750
|
|
87
87
|
jolt/templates/export.sh.template,sha256=PKkflGXFbq70EIsowqcnLvzbnEDnqh_WgC4E_JNT0VE,1937
|
|
88
88
|
jolt/templates/timeline.html.template,sha256=xdqvFBmhE8XRQaWgcIFBVbd__9HdRq6O-U0o276PyjU,1222
|
|
89
|
-
jolt-0.9.
|
|
90
|
-
jolt-0.9.
|
|
91
|
-
jolt-0.9.
|
|
92
|
-
jolt-0.9.
|
|
93
|
-
jolt-0.9.
|
|
89
|
+
jolt-0.9.354.dist-info/METADATA,sha256=A89Lwqfh59XHi1Vh1l7Mss-JPfW01ewUIAsOSUScevw,5557
|
|
90
|
+
jolt-0.9.354.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
91
|
+
jolt-0.9.354.dist-info/entry_points.txt,sha256=VZ-QH38Z9HJc1O57wfzr-soHn6exwc3N0TSrRum4tYg,44
|
|
92
|
+
jolt-0.9.354.dist-info/top_level.txt,sha256=HwzVmAwUrvCUUHRi3zUfcpdKTsdNrZmPCvsrsWSFyqE,5
|
|
93
|
+
jolt-0.9.354.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|