Skip to content

Commit

Permalink
upgrade python version in tox config, fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ar0ne committed Aug 7, 2023
1 parent 486b9ed commit be3024f
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 19 deletions.
4 changes: 2 additions & 2 deletions bgd/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import logging
import os
from typing import List
from typing import List, Type

from dependency_injector.wiring import Provide, inject, required
from environ import Env
Expand Down Expand Up @@ -47,7 +47,7 @@ def startup_event(
cache_backend: Backend = Provide[ApplicationContainer.cache_backend],
cache_prefix: str = Provide["config.cache.prefix", required()],
cache_ttl: int = Provide["config.cache.ttl", required().as_int()],
coder: Coder = Provide[ApplicationContainer.coder],
coder: Type[Coder] = Provide[ApplicationContainer.coder],
) -> None:
"""On startup callback"""
FastAPICache.init(backend=cache_backend, prefix=cache_prefix, expire=cache_ttl, coder=coder)
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/bgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from bgd.constants import BGG
from bgd.responses import GameDetailsResult, GameRank, GameStatistic
from bgd.services.abc import GameDetailsResultFactory
from bgd.services.api_clients import XmlHttpApiClient
from bgd.services.base import GameInfoService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/crowdgames.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from bgd.constants import CROWDGAMES, RUB
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import HtmlHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/hobbygames.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from bgd.constants import HOBBYGAMES
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import HtmlHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/kufar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bgd.constants import BELARUS, KUFAR
from bgd.responses import GameLocation, GameOwner, GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/lavkaigr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from bgd.constants import LAVKAIGR, RUB
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import HtmlHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/onliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bgd.constants import ONLINER
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/ozby.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bgd.constants import OZBY
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/ozon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from bgd.constants import OZON
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/tesera.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from bgd.constants import NOT_AVAILABLE, TESERA
from bgd.responses import GameDetailsResult, GameStatistic
from bgd.services.abc import GameDetailsResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.apis.bgg import BGG_GAME_URL
from bgd.services.base import GameInfoService
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/twenty_first_vek.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bgd.constants import TWENTYFIRSTVEK
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/wildberries.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bgd.constants import WILDBERRIES
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import JsonHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
1 change: 0 additions & 1 deletion bgd/services/apis/znaemigraem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from bgd.constants import ZNAEMIGRAEM
from bgd.responses import GameSearchResult, Price
from bgd.services.abc import GameSearchResultFactory
from bgd.services.api_clients import HtmlHttpApiClient
from bgd.services.base import GameSearchService
from bgd.services.constants import GET
Expand Down
2 changes: 1 addition & 1 deletion bgd/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __init__(self, data_sources: List[GameSearchService], json_coder: Coder) ->

def serialize_event_data(self, data: Any) -> str:
"""Convert event data to JSON-string"""
return self.json_coder.encode(data).decode("utf-8") # pylint: disable=no-member
return self.json_coder.encode(data) # pylint: disable=no-member

async def find_game_deals(self, request: Request, game: str) -> AsyncGenerator[dict, None]:
"""Async game deals searching"""
Expand Down
4 changes: 2 additions & 2 deletions bgd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class ORJsonCoder(Coder):
"""orjson coder"""

@classmethod
def encode(cls, value: Any) -> bytes:
def encode(cls, value: Any) -> str:
"""serialize python object to json-bytes"""
return orjson.dumps(value, default=jsonable_encoder) # pylint: disable=no-member
return str(orjson.dumps(value, default=jsonable_encoder)) # pylint: disable=no-member

@classmethod
def decode(cls, value: Any) -> Any:
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pycodestyle
pylint
safety
tox==3.25.1
types-redis
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist = py310
envlist = py311
toxworkdir={env:TOX_WORK_DIR:.tox}

[gh-actions]
python =
3.10: py310
3.11: py311

[pycodestyle]
max_line_length = 100
Expand Down

0 comments on commit be3024f

Please sign in to comment.