Skip to content

Commit

Permalink
fix: erase optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hyukychang committed Apr 1, 2024
1 parent 1d9a2f8 commit 06930b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ara/controller/pagination.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Any, Optional
from typing import Any

from pydantic import BaseModel


class PaginatedData(BaseModel):
count: int
next: Optional[str]
previous: Optional[str]
next: str | None
previous: str | None
results: list[Any]


Expand Down
4 changes: 2 additions & 2 deletions ara/controller/response.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, NamedTuple, Optional
from typing import Any, NamedTuple

from pydantic import BaseModel

Expand All @@ -11,7 +11,7 @@ class NewAraResponse(NamedTuple):

class NewAraErrorResponseBody(BaseModel):
# necessary
error_code: Optional[int]
error_code: int | None
error_reason: str = ""

def __init__(self, exception: Exception):
Expand Down
8 changes: 4 additions & 4 deletions ara/infra/django_infra.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Generic, Optional, Type, TypeVar, Union
from typing import Any, Generic, Type, TypeVar, Union

from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models import Model
Expand Down Expand Up @@ -31,7 +31,7 @@ def get_by_id(self, id: Any, *, is_select_for_update: bool = False) -> T:
def get_filtered_objects(
self,
*,
columns: Optional[list[str]] = None,
columns: list[str] | None = None,
conditions: dict[str, Any],
is_select_for_update: bool = False,
) -> list[Union[T, dict[str, Any]]]:
Expand All @@ -40,7 +40,7 @@ def get_filtered_objects(
Should not be used for complex & specific purpose queries.
Args:
columns (Optional[List[str]]):
columns (List[str] | None):
List of column names to fetch. Get all columns if None. Default None.
conditions (Dict[str, Any]):
Dictionary of field names and their corresponding values to filter by.
Expand Down Expand Up @@ -93,7 +93,7 @@ def create_manual(self, **kwargs) -> T:
def update_or_create(self, **kwargs) -> tuple[T, bool]:
return self.model.objects.update_or_create(**kwargs)

def get_by(self, **kwargs) -> Optional[T]:
def get_by(self, **kwargs) -> T | None:
"""Returns repository model instance if exists.
:param kwargs: keyword arguments of fields
Expand Down

0 comments on commit 06930b9

Please sign in to comment.