From 1f354c2bbb9eb2fcc8f8e7fbae32bcad72240617 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 19:58:21 +0000 Subject: [PATCH 1/2] Bump black from 23.12.1 to 24.1.1 Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.1.1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.12.1...24.1.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- dev_requirements/requirements-formatting.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_requirements/requirements-formatting.txt b/dev_requirements/requirements-formatting.txt index 67e0cfa..d9feb7b 100644 --- a/dev_requirements/requirements-formatting.txt +++ b/dev_requirements/requirements-formatting.txt @@ -4,7 +4,7 @@ # # pip-compile requirements-formatting.in # -black==23.12.1 +black==24.1.1 # via -r dev_requirements/requirements-formatting.in click==8.1.3 # via black From cc75ec8ba75db16591b7ee9212a2a9180e858b60 Mon Sep 17 00:00:00 2001 From: konstantin Date: Tue, 6 Feb 2024 06:59:41 +0000 Subject: [PATCH 2/2] black 2024 stable style --- src/pvframework/analysis.py | 1 + src/pvframework/errors.py | 1 + src/pvframework/execution.py | 1 + src/pvframework/mapped_validators/__init__.py | 1 + src/pvframework/mapped_validators/path_map.py | 1 + src/pvframework/mapped_validators/query_map.py | 1 + src/pvframework/mapped_validators/query_parallel_map.py | 1 + src/pvframework/types.py | 4 ++-- src/pvframework/utils/__init__.py | 1 + src/pvframework/utils/frame_functions.py | 1 + src/pvframework/utils/query_object.py | 9 +++++---- src/pvframework/validator.py | 7 +++---- 12 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/pvframework/analysis.py b/src/pvframework/analysis.py index 7f2699c..8060bed 100644 --- a/src/pvframework/analysis.py +++ b/src/pvframework/analysis.py @@ -1,6 +1,7 @@ """ Contains functionality to analyze the result of a validation process """ + import itertools from typing import TYPE_CHECKING, Generic, Optional diff --git a/src/pvframework/errors.py b/src/pvframework/errors.py index a3f962e..9a6af4b 100644 --- a/src/pvframework/errors.py +++ b/src/pvframework/errors.py @@ -1,6 +1,7 @@ """ Contains functionality to handle all the ValidationErrors and creating error IDs. """ + import asyncio import hashlib import logging diff --git a/src/pvframework/execution.py b/src/pvframework/execution.py index aae5dd4..a815f45 100644 --- a/src/pvframework/execution.py +++ b/src/pvframework/execution.py @@ -2,6 +2,7 @@ Here is the main stuff. The ValidationManager bundles several mapped validators and can validate data sets onto these. """ + import asyncio import csv import logging diff --git a/src/pvframework/mapped_validators/__init__.py b/src/pvframework/mapped_validators/__init__.py index 070d30d..abdf804 100644 --- a/src/pvframework/mapped_validators/__init__.py +++ b/src/pvframework/mapped_validators/__init__.py @@ -1,6 +1,7 @@ """ This module contains some usable the mapped validators. """ + from .path_map import PathMappedValidator from .query_map import Query, QueryMappedValidator from .query_parallel_map import ParallelQueryMappedValidator diff --git a/src/pvframework/mapped_validators/path_map.py b/src/pvframework/mapped_validators/path_map.py index 1b35b74..9de8fdf 100644 --- a/src/pvframework/mapped_validators/path_map.py +++ b/src/pvframework/mapped_validators/path_map.py @@ -2,6 +2,7 @@ Contains a PathMappedValidator which gets the values from the data set in a very simple way. If you need a more customizable MappedValidator you may be interested in the `QueryMappedValidator`. """ + from typing import Any, Generator from frozendict import frozendict diff --git a/src/pvframework/mapped_validators/query_map.py b/src/pvframework/mapped_validators/query_map.py index bc47cfb..c375577 100644 --- a/src/pvframework/mapped_validators/query_map.py +++ b/src/pvframework/mapped_validators/query_map.py @@ -2,6 +2,7 @@ Contains logic to retrieve the data from the data sets in a more complex and more general manner than the PathMappedValidator. With this it is e.g. possible to iterate through lists and execute the validator for each element. """ + import itertools from collections import OrderedDict from typing import Any, Callable, Generator, Iterable, Iterator, Optional, Self, TypeAlias diff --git a/src/pvframework/mapped_validators/query_parallel_map.py b/src/pvframework/mapped_validators/query_parallel_map.py index 0287f75..91f3a81 100644 --- a/src/pvframework/mapped_validators/query_parallel_map.py +++ b/src/pvframework/mapped_validators/query_parallel_map.py @@ -1,6 +1,7 @@ """ This module contains the ParallelQueryMappedValidator class. """ + from typing import Any, Iterator, Optional from pvframework.types import DataSetT, ValidatorFunctionT diff --git a/src/pvframework/types.py b/src/pvframework/types.py index 62a4d5a..1ab7978 100644 --- a/src/pvframework/types.py +++ b/src/pvframework/types.py @@ -1,6 +1,7 @@ """ Contains the types used in the validation framework """ + from typing import TYPE_CHECKING, Any, Callable, Coroutine, Protocol, TypeAlias, TypeVar if TYPE_CHECKING: @@ -12,8 +13,7 @@ class Hashable(Protocol): A protocol that defines the __hash__ method. """ - def __hash__(self) -> int: - ... + def __hash__(self) -> int: ... DataSetT = TypeVar("DataSetT", bound=Hashable) diff --git a/src/pvframework/utils/__init__.py b/src/pvframework/utils/__init__.py index 56bb63e..575b2b8 100644 --- a/src/pvframework/utils/__init__.py +++ b/src/pvframework/utils/__init__.py @@ -1,5 +1,6 @@ """ This module contains utility functions that can be used inside validator functions. """ + from .frame_functions import param from .query_object import optional_field, required_field diff --git a/src/pvframework/utils/frame_functions.py b/src/pvframework/utils/frame_functions.py index 9fa0501..1b002b9 100644 --- a/src/pvframework/utils/frame_functions.py +++ b/src/pvframework/utils/frame_functions.py @@ -1,6 +1,7 @@ """ Contains some useful utility functions to be used in validator functions. """ + import inspect from typing import Optional diff --git a/src/pvframework/utils/query_object.py b/src/pvframework/utils/query_object.py index 78c6b07..0a9589e 100644 --- a/src/pvframework/utils/query_object.py +++ b/src/pvframework/utils/query_object.py @@ -1,6 +1,7 @@ """ Contains some useful utility functions to be used in validator functions. """ + from typing import TYPE_CHECKING, Any, Optional, TypeVar, overload from typeguard import TypeCheckError, check_type @@ -26,13 +27,13 @@ def optional_field(obj: Any, attribute_path: str, attribute_type: type[AttrT]) - @overload def required_field( obj: Any, attribute_path: str, attribute_type: type[AttrT], param_base_path: Optional[str] = None -) -> AttrT: - ... +) -> AttrT: ... @overload -def required_field(obj: Any, attribute_path: str, attribute_type: Any, param_base_path: Optional[str] = None) -> Any: - ... +def required_field( + obj: Any, attribute_path: str, attribute_type: Any, param_base_path: Optional[str] = None +) -> Any: ... def required_field(obj: Any, attribute_path: str, attribute_type: Any, param_base_path: Optional[str] = None) -> Any: diff --git a/src/pvframework/validator.py b/src/pvframework/validator.py index abf283c..7e60576 100644 --- a/src/pvframework/validator.py +++ b/src/pvframework/validator.py @@ -2,6 +2,7 @@ Contains functionality to build up a box of information around a validator function before registering it to a ValidationManager. This reduces complexity inside the ValidationManager. """ + import asyncio import inspect import logging @@ -174,15 +175,13 @@ def is_async(self) -> bool: @overload def is_async( validator: "MappedValidatorT", -) -> TypeGuard["MappedValidator[Any, AsyncValidatorFunction]"]: - ... +) -> TypeGuard["MappedValidator[Any, AsyncValidatorFunction]"]: ... @overload def is_async( validator: "ValidatorT", -) -> TypeGuard["Validator[Any, AsyncValidatorFunction]"]: - ... +) -> TypeGuard["Validator[Any, AsyncValidatorFunction]"]: ... def is_async(