Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@icontract.ensure(lambda result: all(single_res[1].is_absolute() for single_res in result))
def some_func() -> List[Tuple[pathlib.Path, pathlib.Path]]:
return [(pathlib.Path("/home/file1"), pathlib.Path("home/file2"))]
@icontract.ensure(lambda result: result < 100)
def func(self) -> int:
return 1000
@icontract.ensure(lambda self: self.some_prop > 0)
def some_prop(self) -> None:
pass
@icontract.ensure(lambda result: result > 0)
def some_method(self) -> int:
self.x = -1
return 10
@icontract.ensure(lambda OLD, val, lst: OLD.len_lst + 1 == len(lst))
def some_func(lst: List[int], val: int) -> None:
lst.append(val)
lst.append(1984)
@icontract.ensure(lambda OLD, self, val: OLD.lst + [val] == self.lst)
def some_func(self, val: int) -> None:
self.lst.append(val)
self.lst.append(1984)
@icontract.ensure(lambda result, x: result > x, "expected summation")
def some_func(x: int, y: int = 5) -> int:
return x - y
@icontract.ensure(lambda result: result % 3 == 0)
def func(self) -> int:
return 2
@icontract.ensure(lambda OLD, val, lst: OLD.len_lst + 1 == len(lst))
def some_func(lst: List[int], val: int) -> None:
lst.append(val)