Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Jan 29, 2024
1 parent 686d803 commit eb69726
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 93 deletions.
1 change: 1 addition & 0 deletions docs_src/tips/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Generated by 'esmerald-admin createproject'
"""

from functools import cached_property
from typing import Optional, Tuple

Expand Down
1 change: 1 addition & 0 deletions saffier/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Client to interact with Saffier models and migrations.
"""

import inspect
import sys
import typing
Expand Down
1 change: 0 additions & 1 deletion saffier/cli/operations/branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Client to interact with Saffier models and migrations.
"""


import click

from saffier.cli.base import branches as _branches
Expand Down
1 change: 1 addition & 0 deletions saffier/cli/operations/list_templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Client to interact with Saffier models and migrations.
"""

import click

from saffier.cli.base import list_templates as template_list
Expand Down
3 changes: 1 addition & 2 deletions saffier/contrib/multi_tenancy/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from saffier.exceptions import SaffierException


class ModelSchemaError(SaffierException):
...
class ModelSchemaError(SaffierException): ...
6 changes: 2 additions & 4 deletions saffier/core/db/models/metaclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,7 @@ def __new__(cls, name: str, bases: Tuple[Type, ...], attrs: Any) -> Any:
return new_model


class ModelMeta(metaclass=BaseModelMeta):
...
class ModelMeta(metaclass=BaseModelMeta): ...


class ReflectMeta(metaclass=BaseModelReflectMeta):
...
class ReflectMeta(metaclass=BaseModelReflectMeta): ...
39 changes: 13 additions & 26 deletions saffier/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,43 @@ def __str__(self) -> str:
return "".join(self.args).strip()


class ObjectNotFound(SaffierException):
...
class ObjectNotFound(SaffierException): ...


DoesNotFound = ObjectNotFound


class MultipleObjectsReturned(SaffierException):
...
class MultipleObjectsReturned(SaffierException): ...


class ValidationError(BaseError):
...
class ValidationError(BaseError): ...


class ImproperlyConfigured(SaffierException):
...
class ImproperlyConfigured(SaffierException): ...


class ForeignKeyBadConfigured(SaffierException):
...
class ForeignKeyBadConfigured(SaffierException): ...


class RelationshipIncompatible(SaffierException):
...
class RelationshipIncompatible(SaffierException): ...


class DuplicateRecordError(SaffierException):
...
class DuplicateRecordError(SaffierException): ...


class RelationshipNotFound(SaffierException):
...
class RelationshipNotFound(SaffierException): ...


class QuerySetError(SaffierException):
...
class QuerySetError(SaffierException): ...


class ModelReferenceError(SaffierException):
...
class ModelReferenceError(SaffierException): ...


class SchemaError(SaffierException):
...
class SchemaError(SaffierException): ...


class SignalError(SaffierException):
...
class SignalError(SaffierException): ...


class CommandEnvironmentError(SaffierException):
...
class CommandEnvironmentError(SaffierException): ...
6 changes: 2 additions & 4 deletions saffier/protocols/many_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
class ManyRelationProtocol(Protocol):
"""Defines the what needs to be implemented when using the ManyRelationProtocol"""

async def add(self, child: "Model") -> None:
...
async def add(self, child: "Model") -> None: ...

async def remove(self, child: "Model") -> None:
...
async def remove(self, child: "Model") -> None: ...
80 changes: 28 additions & 52 deletions saffier/protocols/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,68 +27,47 @@
class QuerySetProtocol(Protocol):
"""Defines the what needs to be implemented when using the ManyRelationProtocol"""

def filter(self, **kwargs: Any) -> "QuerySet":
...
def filter(self, **kwargs: Any) -> "QuerySet": ...

def exclude(self, **kwargs: "Model") -> "QuerySet":
...
def exclude(self, **kwargs: "Model") -> "QuerySet": ...

def lookup(self, **kwargs: Any) -> "QuerySet":
...
def lookup(self, **kwargs: Any) -> "QuerySet": ...

def order_by(self, columns: Union[List, str]) -> "QuerySet":
...
def order_by(self, columns: Union[List, str]) -> "QuerySet": ...

def limit(self, limit_count: int) -> "QuerySet":
...
def limit(self, limit_count: int) -> "QuerySet": ...

def offset(self, offset: int) -> "QuerySet":
...
def offset(self, offset: int) -> "QuerySet": ...

def group_by(self, group_by: Union[List, str]) -> "QuerySet":
...
def group_by(self, group_by: Union[List, str]) -> "QuerySet": ...

def distinct(self, distinct_on: Union[List, str]) -> "QuerySet":
...
def distinct(self, distinct_on: Union[List, str]) -> "QuerySet": ...

def select_related(self, related: Union[List, str]) -> "QuerySet":
...
def select_related(self, related: Union[List, str]) -> "QuerySet": ...

async def exists(self) -> bool:
...
async def exists(self) -> bool: ...

async def count(self) -> int:
...
async def count(self) -> int: ...

async def get_or_none(self, **kwargs: Any) -> Union[SaffierModel, None]:
...
async def get_or_none(self, **kwargs: Any) -> Union[SaffierModel, None]: ...

async def all(self, **kwargs: Any) -> Sequence[Optional[SaffierModel]]:
...
async def all(self, **kwargs: Any) -> Sequence[Optional[SaffierModel]]: ...

async def get(self, **kwargs: Any) -> SaffierModel:
...
async def get(self, **kwargs: Any) -> SaffierModel: ...

async def first(self, **kwargs: Any) -> Union[SaffierModel, None]:
...
async def first(self, **kwargs: Any) -> Union[SaffierModel, None]: ...

async def last(self, **kwargs: Any) -> Union[SaffierModel, None]:
...
async def last(self, **kwargs: Any) -> Union[SaffierModel, None]: ...

async def create(self, **kwargs: Any) -> SaffierModel:
...
async def create(self, **kwargs: Any) -> SaffierModel: ...

async def bulk_create(self, objs: Sequence[List[Dict[Any, Any]]]) -> None:
...
async def bulk_create(self, objs: Sequence[List[Dict[Any, Any]]]) -> None: ...

async def bulk_update(self, objs: Sequence[List[SaffierModel]], fields: List[str]) -> None:
...
async def bulk_update(self, objs: Sequence[List[SaffierModel]], fields: List[str]) -> None: ...

async def delete(self) -> None:
...
async def delete(self) -> None: ...

async def update(self, **kwargs: Any) -> None:
...
async def update(self, **kwargs: Any) -> None: ...

async def values(
self,
Expand All @@ -97,27 +76,24 @@ async def values(
exclude_none: bool,
flatten: bool,
**kwargs: Any,
) -> List[Any]:
...
) -> List[Any]: ...

async def values_list(
self,
fields: Union[Sequence[str], str, None],
exclude: Union[Sequence[str], Set[str]],
exclude_none: bool,
flat: bool,
) -> List[Any]:
...
) -> List[Any]: ...

async def get_or_create(
self,
_defaults: Optional[Dict[str, Any]] = None,
**kwargs: Any,
) -> Tuple[SaffierModel, bool]:
...
) -> Tuple[SaffierModel, bool]: ...

async def update_or_create(self, defaults: Any, **kwargs: Any) -> Tuple[SaffierModel, bool]:
...
async def update_or_create(
self, defaults: Any, **kwargs: Any
) -> Tuple[SaffierModel, bool]: ...

async def contains(self, instance: SaffierModel) -> bool:
...
async def contains(self, instance: SaffierModel) -> bool: ...
3 changes: 1 addition & 2 deletions tests/prefetch/test_prefetch_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ async def rollback_connections():
yield


class Test:
...
class Test: ...


async def test_raise_prefetch_related_error():
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 @@ -68,8 +68,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 eb69726

Please sign in to comment.