From eb5ff50c423ad4f13c5f8e2c8082bfe115cb69de Mon Sep 17 00:00:00 2001 From: tarsil Date: Mon, 29 Jan 2024 16:09:31 +0000 Subject: [PATCH 1/2] Update requirements --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 99eb618..724db0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ classifiers = [ ] dependencies = [ "motor>=3.3.1", - "dymmond-settings>=1.0.1", + "dymmond-settings>=1.0.2", "orjson>=3.9.5", "pydantic>=2.5.3,<3.0.0", ] @@ -56,18 +56,18 @@ Source = "https://github.com/tarsil/mongoz" [project.optional-dependencies] test = [ "autoflake>=2.0.2,<3.0.0", - "black>=23.3.0,<24.0.0", + "black==24.1.1,<25.0", "esmerald>=2.0.6", "isort>=5.12.0,<6.0.0", "mypy==1.5.1", - "pytest>=7.2.2,<8.0.0", + "pytest>=7.2.2,<9.0.0", "pytest-asyncio>=0.21.1,<1.0.0", "pytest-cov>=4.0.0,<5.0.0", "requests>=2.28.2", "ruff>=0.0.256,<1.0.0", ] -dev = ["anyio>=3.6.2,<5", "ipdb>=0.13.13,<1.0.0", "pre-commit>=3.3.1,<4.0.0"] +dev = ["anyio>=4.0.0,<5", "ipdb>=0.13.13,<1.0.0", "pre-commit>=3.3.1,<4.0.0"] doc = [ "mkautodoc>=0.2.0,<0.3.0", From c3ef33d992ca2f7cdfb1157c7f0db07e4b9d881f Mon Sep 17 00:00:00 2001 From: tarsil Date: Mon, 29 Jan 2024 16:13:28 +0000 Subject: [PATCH 2/2] Fix linting --- mongoz/core/utils/functional.py | 1 + mongoz/exceptions.py | 30 ++++++++++-------------------- mongoz/protocols/queryset.py | 27 +++++++++------------------ tests/signals/test_signals.py | 3 +-- 4 files changed, 21 insertions(+), 40 deletions(-) diff --git a/mongoz/core/utils/functional.py b/mongoz/core/utils/functional.py index 985ab2f..9a08b8a 100644 --- a/mongoz/core/utils/functional.py +++ b/mongoz/core/utils/functional.py @@ -1,6 +1,7 @@ """ All functional common to MongoZ """ + from typing import Any, Dict, Tuple, Union from mongoz.core.db.fields.base import BaseField diff --git a/mongoz/exceptions.py b/mongoz/exceptions.py index f1ab0d1..dde5958 100644 --- a/mongoz/exceptions.py +++ b/mongoz/exceptions.py @@ -19,41 +19,31 @@ def __str__(self) -> str: return "".join(self.args).strip() -class DocumentNotFound(MongozException): - ... +class DocumentNotFound(MongozException): ... -class MultipleDocumentsReturned(MongozException): - ... +class MultipleDocumentsReturned(MongozException): ... -class FieldDefinitionError(MongozException): - ... +class FieldDefinitionError(MongozException): ... -class ImproperlyConfigured(MongozException): - ... +class ImproperlyConfigured(MongozException): ... -class InvalidObjectIdError(MongozException): - ... +class InvalidObjectIdError(MongozException): ... -class InvalidKeyError(MongozException): - ... +class InvalidKeyError(MongozException): ... -class SignalError(MongozException): - ... +class SignalError(MongozException): ... -class AbstractDocumentError(MongozException): - ... +class AbstractDocumentError(MongozException): ... -class OperatorInvalid(MongozException): - ... +class OperatorInvalid(MongozException): ... -class IndexError(MongozException): - ... +class IndexError(MongozException): ... diff --git a/mongoz/protocols/queryset.py b/mongoz/protocols/queryset.py index 2759155..ebfc592 100644 --- a/mongoz/protocols/queryset.py +++ b/mongoz/protocols/queryset.py @@ -11,26 +11,19 @@ class QuerySetProtocol(Protocol): - async def all(self) -> List[T]: - ... + async def all(self) -> List[T]: ... - async def count(self) -> int: - ... + async def count(self) -> int: ... - async def delete(self) -> int: - ... + async def delete(self) -> int: ... - async def first(self) -> Union[T, None]: - ... + async def first(self) -> Union[T, None]: ... - async def last(self) -> Union[T, None]: - ... + async def last(self) -> Union[T, None]: ... - async def get(self) -> T: - ... + async def get(self) -> T: ... - async def get_or_create(self, defaults: Union[Dict[str, Any], None]) -> T: - ... + async def get_or_create(self, defaults: Union[Dict[str, Any], None]) -> T: ... async def limit(self, count: int = 0) -> "QuerySet[T]": # pragma: no cover ... @@ -50,8 +43,6 @@ def sort(self, key: Any, direction: "Order") -> "QuerySet[T]": # pragma: no cov def sort(self, key: List[Tuple[Any, "Order"]]) -> "QuerySet[T]": # pragma: no cover ... - def sort(self, key: Any, direction: Union["Order", None] = None) -> "QuerySet[T]": - ... + def sort(self, key: Any, direction: Union["Order", None] = None) -> "QuerySet[T]": ... - async def update_many(self, **kwargs: Any) -> List[T]: - ... + async def update_many(self, **kwargs: Any) -> List[T]: ... diff --git a/tests/signals/test_signals.py b/tests/signals/test_signals.py index 3800c4a..040263b 100644 --- a/tests/signals/test_signals.py +++ b/tests/signals/test_signals.py @@ -56,8 +56,7 @@ def test_passing_no_kwargs(): with pytest.raises(SignalError): @pre_save(User) - def execute(sender, instance): - ... + def execute(sender, instance): ... def test_invalid_signal():