Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@icontract.post(lambda self: self.x >= 0)
def __init__(self, x: int) -> None:
self.x = x
@icontract.post(lambda x, result: x > result, enabled=False)
def some_func(x: int) -> int:
return 123
@icontract.post(lambda OLD, a: a == OLD.a)
def some_function(a: List[int], OLD: int) -> None: # pylint: disable=unused-variable
pass
@icontract.post(lambda result: result > 0)
def some_method(self) -> int:
self.x = 10
return -1
@icontract.post(lambda OLD, val, lst: OLD.lst + [val] == lst)
def some_func(lst: List[int], val: int) -> None:
lst.append(val)
@icontract.post(lambda result, x: len(result) > x, a_repr=a_repr)
def some_func(x: int) -> List[int]:
return list(range(x))
@icontract.post(lambda result: result > 0, error=lambda: ValueError("result must be positive"))
def some_func(x: int) -> int:
return x
@icontract.post(lambda self: self.x < 0)
def __init__(self, x: int) -> None:
self.x = x
@icontract.post(lambda OLD, self: self.sets == OLD.sets + 1)
def some_prop(self, value: int) -> None:
return
@icontract.post(
lambda result, x: result > x, repr_args=lambda result, x: "result was {:05}, x was {:05}".format(result, x))
def some_func(x: int, y: int = 5) -> int:
return x - y