From 5b3cd54ae67b4d5e543b60740cf6c95e591861aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:24:47 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dev/generate_filter.py | 1 + easyverein/api.py | 1 + easyverein/core/client.py | 1 + easyverein/core/protocol.py | 15 +++++---------- easyverein/core/types.py | 1 + easyverein/models/contact_details.py | 1 + easyverein/models/custom_field.py | 16 ++++++++++------ easyverein/models/invoice.py | 16 +++++++++++++--- easyverein/models/invoice_item.py | 1 + easyverein/models/member.py | 1 + easyverein/models/mixins/empty_strings_mixin.py | 1 + easyverein/models/mixins/required_attributes.py | 1 + easyverein/modules/contact_details.py | 1 + easyverein/modules/custom_field.py | 1 + easyverein/modules/invoice_item.py | 1 + easyverein/modules/member.py | 1 + easyverein/modules/member_custom_field.py | 1 + 17 files changed, 42 insertions(+), 19 deletions(-) diff --git a/dev/generate_filter.py b/dev/generate_filter.py index 0188187..19f4f73 100644 --- a/dev/generate_filter.py +++ b/dev/generate_filter.py @@ -1,6 +1,7 @@ """ Helper script to automatically generate pydantic models from a swagger spec """ + import json import sys from pathlib import Path diff --git a/easyverein/api.py b/easyverein/api.py index 266f7af..06e500a 100644 --- a/easyverein/api.py +++ b/easyverein/api.py @@ -1,6 +1,7 @@ """ Main EasyVerein API class """ + import logging from .core.client import EasyvereinClient diff --git a/easyverein/core/client.py b/easyverein/core/client.py index 86b6869..2845c81 100644 --- a/easyverein/core/client.py +++ b/easyverein/core/client.py @@ -1,6 +1,7 @@ """ Main EasyVerein API class """ + from __future__ import annotations import logging diff --git a/easyverein/core/protocol.py b/easyverein/core/protocol.py index c3fb4bf..39a42b3 100644 --- a/easyverein/core/protocol.py +++ b/easyverein/core/protocol.py @@ -9,21 +9,16 @@ # noinspection PyPropertyDefinition class IsEVClientProtocol(Protocol): @property - def logger(self) -> logging.Logger: - ... + def logger(self) -> logging.Logger: ... @property - def c(self) -> EasyvereinClient: - ... + def c(self) -> EasyvereinClient: ... @property - def endpoint_name(self) -> str: - ... + def endpoint_name(self) -> str: ... @property - def model_class(self) -> TypeVar: - ... + def model_class(self) -> TypeVar: ... @property - def return_type(self) -> Type[BaseModel]: - ... + def return_type(self) -> Type[BaseModel]: ... diff --git a/easyverein/core/types.py b/easyverein/core/types.py index 5c0d6dc..f5adafb 100644 --- a/easyverein/core/types.py +++ b/easyverein/core/types.py @@ -1,6 +1,7 @@ """ Custom types used for model validation """ + import datetime import json from typing import Annotated diff --git a/easyverein/models/contact_details.py b/easyverein/models/contact_details.py index ab594be..739f1f4 100644 --- a/easyverein/models/contact_details.py +++ b/easyverein/models/contact_details.py @@ -1,6 +1,7 @@ """ Contact Details related models """ + from __future__ import annotations from typing import Any, Literal diff --git a/easyverein/models/custom_field.py b/easyverein/models/custom_field.py index ca99e8b..5500fab 100644 --- a/easyverein/models/custom_field.py +++ b/easyverein/models/custom_field.py @@ -1,6 +1,7 @@ """ Member related models """ + from __future__ import annotations from typing import Literal @@ -36,9 +37,9 @@ class CustomFieldBase(EasyVereinBase): color: HexColor = None short: str | None = Field(default=None, max_length=4) orderSequence: PositiveIntWithZero | None = None - settings_type: Literal[ - "t", "f", "z", "d", "c", "r", "s", "a", "b", "m" - ] | None = None + settings_type: Literal["t", "f", "z", "d", "c", "r", "s", "a", "b", "m"] | None = ( + None + ) """ Settings type defines which type of field this custom field should be. Possible values: @@ -55,9 +56,12 @@ class CustomFieldBase(EasyVereinBase): If type is set to s or a, the possible options need to be defined in the additional field """ - kind: Literal[ - "a", "b", "ba", "ca", "iv", "t", "u", "ic", "c", "e", "h", "j", "i", "k" - ] | None = None + kind: ( + Literal[ + "a", "b", "ba", "ca", "iv", "t", "u", "ic", "c", "e", "h", "j", "i", "k" + ] + | None + ) = None """ Kind defines in which context this custom field is used. Unfortunately only some possible values are documented in the API spec: diff --git a/easyverein/models/invoice.py b/easyverein/models/invoice.py index 1a5f640..73c1afb 100644 --- a/easyverein/models/invoice.py +++ b/easyverein/models/invoice.py @@ -1,6 +1,7 @@ """ Invoice related models """ + from __future__ import annotations from typing import Literal @@ -42,9 +43,18 @@ class InvoiceBase(EasyVereinBase): taxName: str | None = None relatedAddress: ContactDetails | EasyVereinReference | None = None path: EasyVereinReference | None = None - kind: Literal[ - "balance", "donation", "membership", "revenue", "expense", "cancel", "credit" - ] | None = None + kind: ( + Literal[ + "balance", + "donation", + "membership", + "revenue", + "expense", + "cancel", + "credit", + ] + | None + ) = None # TODO: Add reference to BillingAccount once implemented selectionAcc: EasyVereinReference | None = None refNumber: str | None = None diff --git a/easyverein/models/invoice_item.py b/easyverein/models/invoice_item.py index 61caa39..84b5b97 100644 --- a/easyverein/models/invoice_item.py +++ b/easyverein/models/invoice_item.py @@ -1,6 +1,7 @@ """ Invoice Item model """ + from __future__ import annotations from typing import Annotated diff --git a/easyverein/models/member.py b/easyverein/models/member.py index 4e640ba..585f84d 100644 --- a/easyverein/models/member.py +++ b/easyverein/models/member.py @@ -1,6 +1,7 @@ """ Member related models """ + from __future__ import annotations from typing import Literal diff --git a/easyverein/models/mixins/empty_strings_mixin.py b/easyverein/models/mixins/empty_strings_mixin.py index c4a46c9..dfb49bf 100644 --- a/easyverein/models/mixins/empty_strings_mixin.py +++ b/easyverein/models/mixins/empty_strings_mixin.py @@ -2,6 +2,7 @@ This module contains a generic plugin for Pydantic models that removes empty strings and converts them to None. """ + from typing import Any from pydantic import model_validator diff --git a/easyverein/models/mixins/required_attributes.py b/easyverein/models/mixins/required_attributes.py index fb8d99b..a77e86c 100644 --- a/easyverein/models/mixins/required_attributes.py +++ b/easyverein/models/mixins/required_attributes.py @@ -1,6 +1,7 @@ """ This module contains a class factory returning a Mixin class """ + from typing import Self from pydantic import BaseModel, model_validator diff --git a/easyverein/modules/contact_details.py b/easyverein/modules/contact_details.py index ebaa30b..98eb2ea 100644 --- a/easyverein/modules/contact_details.py +++ b/easyverein/modules/contact_details.py @@ -1,6 +1,7 @@ """ All methods related to contact details """ + import logging from ..core.client import EasyvereinClient diff --git a/easyverein/modules/custom_field.py b/easyverein/modules/custom_field.py index 65f95ec..fffafce 100644 --- a/easyverein/modules/custom_field.py +++ b/easyverein/modules/custom_field.py @@ -1,6 +1,7 @@ """ All methods related to custom fields """ + import logging from ..core.client import EasyvereinClient diff --git a/easyverein/modules/invoice_item.py b/easyverein/modules/invoice_item.py index 5aade84..5eecd30 100644 --- a/easyverein/modules/invoice_item.py +++ b/easyverein/modules/invoice_item.py @@ -1,6 +1,7 @@ """ All methods related to invoices """ + import logging from ..core.client import EasyvereinClient diff --git a/easyverein/modules/member.py b/easyverein/modules/member.py index 6104250..8d8f6e8 100644 --- a/easyverein/modules/member.py +++ b/easyverein/modules/member.py @@ -1,6 +1,7 @@ """ All methods related to invoices """ + import logging from ..core.client import EasyvereinClient diff --git a/easyverein/modules/member_custom_field.py b/easyverein/modules/member_custom_field.py index 3ea6f40..d48da90 100644 --- a/easyverein/modules/member_custom_field.py +++ b/easyverein/modules/member_custom_field.py @@ -1,6 +1,7 @@ """ All methods related to invoices """ + import logging from ..core.client import EasyvereinClient