Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions icontract/_checkers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide functions to add/find contract checkers."""

import contextvars
import functools
import inspect
Expand Down Expand Up @@ -1289,15 +1290,21 @@ def add_invariant_checks(cls: ClassT) -> None:

for name, prop in names_properties:
new_prop = property(
fget=_decorate_with_invariants(func=prop.fget, is_init=False)
if prop.fget
else None,
fset=_decorate_with_invariants(func=prop.fset, is_init=False)
if prop.fset
else None,
fdel=_decorate_with_invariants(func=prop.fdel, is_init=False)
if prop.fdel
else None,
fget=(
_decorate_with_invariants(func=prop.fget, is_init=False)
if prop.fget
else None
),
fset=(
_decorate_with_invariants(func=prop.fset, is_init=False)
if prop.fset
else None
),
fdel=(
_decorate_with_invariants(func=prop.fdel, is_init=False)
if prop.fdel
else None
),
doc=prop.__doc__,
)
setattr(cls, name, new_prop)
1 change: 1 addition & 0 deletions icontract/_decorators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Define public decorators."""

import inspect
import reprlib
import traceback
Expand Down
1 change: 1 addition & 0 deletions icontract/_metaclass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Define the metaclass necessary to inherit the contracts from the base classes."""

import abc
import inspect
import sys
Expand Down
3 changes: 2 additions & 1 deletion icontract/_represent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Handle representations necessary for informative error messages."""

import ast
import inspect
import re
Expand Down Expand Up @@ -405,7 +406,7 @@ def find_lambda_condition(


def inspect_lambda_condition(
condition: Callable[..., Any]
condition: Callable[..., Any],
) -> Optional[ConditionLambdaInspection]:
"""
Try to extract the source code of the condition as lambda.
Expand Down
1 change: 1 addition & 0 deletions icontract/_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Define data structures shared among the modules."""

import enum
import inspect
import reprlib
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

import os
import sys

Expand Down Expand Up @@ -67,7 +68,7 @@
"astor==0.8.1",
"numpy>=1,<2",
'mypy==1.5.1;python_version>="3.8"',
'black==23.9.1;python_version>="3.8"',
'black==24.8.0;python_version>="3.8"',
'deal>=4,<5;python_version>="3.8"',
'asyncstdlib==3.9.1;python_version>="3.8"',
]
Expand Down
1 change: 1 addition & 0 deletions tests/mock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide mock structures used accross the tests."""

from typing import List, Union


Expand Down