Skip to content

Commit

Permalink
Merge pull request #22 from tarsil/feat/ups
Browse files Browse the repository at this point in the history
Feat/ups
  • Loading branch information
tarsil authored Jan 29, 2024
2 parents 1199dcd + c3ef33d commit 4f2a520
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 44 deletions.
1 change: 1 addition & 0 deletions mongoz/core/utils/functional.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
All functional common to MongoZ
"""

from typing import Any, Dict, Tuple, Union

from mongoz.core.db.fields.base import BaseField
Expand Down
30 changes: 10 additions & 20 deletions mongoz/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...
27 changes: 9 additions & 18 deletions mongoz/protocols/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
...
Expand All @@ -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]: ...
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions tests/signals/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 4f2a520

Please sign in to comment.