TRelativeJobId = WithDesc("RelativeJobId")(TStrictNegativeInt)
+def TInstanceOf(my_inst):
+ """Checks if a given value is an instance of my_inst.
+
+ """
+ desc = WithDesc("Instance of %s" % (Parens(my_inst), ))
+ return desc(lambda val: isinstance(val, my_inst))
+
+
def TListOf(my_type):
"""Checks if a given value is a list with all elements of the same type.
return desc(TAnd(TList, lambda lst: compat.all(my_type(v) for v in lst)))
+TMaybeListOf = lambda item_type: TOr(TNone, TListOf(item_type))
+
+
def TDictOf(key_type, val_type):
"""Checks a dict type for the type of its key/values.