Revision b247c6fc lib/ht.py
b/lib/ht.py | ||
---|---|---|
22 | 22 |
"""Module implementing the parameter types code.""" |
23 | 23 |
|
24 | 24 |
import re |
25 |
import operator |
|
25 | 26 |
|
26 | 27 |
from ganeti import compat |
27 | 28 |
from ganeti import utils |
... | ... | |
297 | 298 |
TStrictPositiveInt = \ |
298 | 299 |
TAnd(TInt, WithDesc("GreaterThanZero")(lambda v: v > 0)) |
299 | 300 |
|
301 |
#: a strictly negative integer (0 > value) |
|
302 |
TStrictNegativeInt = \ |
|
303 |
TAnd(TInt, WithDesc("LessThanZero")(compat.partial(operator.gt, 0))) |
|
304 |
|
|
300 | 305 |
#: a positive float |
301 | 306 |
TPositiveFloat = \ |
302 | 307 |
TAnd(TFloat, WithDesc("EqualGreaterZero")(lambda v: v >= 0.0)) |
... | ... | |
308 | 313 |
#: Number |
309 | 314 |
TNumber = TOr(TInt, TFloat) |
310 | 315 |
|
316 |
#: Relative job ID |
|
317 |
TRelativeJobId = WithDesc("RelativeJobId")(TStrictNegativeInt) |
|
318 |
|
|
311 | 319 |
|
312 | 320 |
def TListOf(my_type): |
313 | 321 |
"""Checks if a given value is a list with all elements of the same type. |
Also available in: Unified diff