From fec46573dae83d064b524c5eae01f44bc7e4698a Mon Sep 17 00:00:00 2001 From: Marko Ristin-Kaufmann Date: Tue, 28 Oct 2025 15:06:09 +0100 Subject: [PATCH] Update black to 24.8.0 We update black formatter to the latest version supported by Python 3.8 for better maintainability in the future. In particular, we want to avoid big jumps in formatting with future versions. --- icontract/_checkers.py | 25 ++++++++++++++++--------- icontract/_decorators.py | 1 + icontract/_metaclass.py | 1 + icontract/_represent.py | 3 ++- icontract/_types.py | 1 + setup.py | 3 ++- tests/mock.py | 1 + 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/icontract/_checkers.py b/icontract/_checkers.py index 5e18a67..0503317 100644 --- a/icontract/_checkers.py +++ b/icontract/_checkers.py @@ -1,4 +1,5 @@ """Provide functions to add/find contract checkers.""" + import contextvars import functools import inspect @@ -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) diff --git a/icontract/_decorators.py b/icontract/_decorators.py index c7b0ecd..45892ad 100644 --- a/icontract/_decorators.py +++ b/icontract/_decorators.py @@ -1,4 +1,5 @@ """Define public decorators.""" + import inspect import reprlib import traceback diff --git a/icontract/_metaclass.py b/icontract/_metaclass.py index a835f03..3be6fea 100644 --- a/icontract/_metaclass.py +++ b/icontract/_metaclass.py @@ -1,4 +1,5 @@ """Define the metaclass necessary to inherit the contracts from the base classes.""" + import abc import inspect import sys diff --git a/icontract/_represent.py b/icontract/_represent.py index 2b33fc6..162ca71 100644 --- a/icontract/_represent.py +++ b/icontract/_represent.py @@ -1,4 +1,5 @@ """Handle representations necessary for informative error messages.""" + import ast import inspect import re @@ -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. diff --git a/icontract/_types.py b/icontract/_types.py index 727be67..3831967 100644 --- a/icontract/_types.py +++ b/icontract/_types.py @@ -1,4 +1,5 @@ """Define data structures shared among the modules.""" + import enum import inspect import reprlib diff --git a/setup.py b/setup.py index a8dd733..fa05c42 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ + import os import sys @@ -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"', ] diff --git a/tests/mock.py b/tests/mock.py index ae1cda9..691e4a9 100644 --- a/tests/mock.py +++ b/tests/mock.py @@ -1,4 +1,5 @@ """Provide mock structures used accross the tests.""" + from typing import List, Union