Skip to content

Commit 2c8734d

Browse files
committed
make format
1 parent 20378e4 commit 2c8734d

8 files changed

Lines changed: 38 additions & 43 deletions

File tree

fixprice_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .manager import FixPriceAPI
21
from .abstraction import CatalogSort
2+
from .manager import FixPriceAPI
33

44
__all__ = ["FixPriceAPI", "CatalogSort"]
55
__version__ = "0.2.4.1"

fixprice_api/endpoints/advertising.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""Реклама"""
22

3-
from human_requests import autotest
4-
from human_requests.abstraction import FetchResponse, HttpMethod
53
from typing import TYPE_CHECKING
64

7-
from human_requests import ApiChild
5+
from human_requests import ApiChild, autotest
6+
from human_requests.abstraction import FetchResponse, HttpMethod
87

98
if TYPE_CHECKING:
109
from fixprice_api.manager import FixPriceAPI

fixprice_api/endpoints/catalog.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from __future__ import annotations
44

55
import json
6+
from dataclasses import dataclass
67
from types import MethodType
8+
from typing import TYPE_CHECKING, Optional, overload
79

10+
from human_requests import ApiChild, ApiParent, api_child_field, autotest
11+
from human_requests.abstraction import FetchResponse, HttpMethod
812
from playwright.async_api import Response as PWResponse
9-
from dataclasses import dataclass
10-
from typing import Optional, TYPE_CHECKING, overload
13+
1114
from .. import abstraction
12-
from human_requests import autotest
13-
from human_requests.abstraction import FetchResponse, HttpMethod
14-
from human_requests import ApiChild, ApiParent, api_child_field
1515

1616
if TYPE_CHECKING:
1717
from fixprice_api.manager import FixPriceAPI
@@ -172,9 +172,10 @@ async def info(
172172
}
173173
""")
174174

175-
176175
nuxt_data = (
177-
json.loads(raw_json)["useState"]["uniquePseudoAsyncDataStateKey"]["product"]
176+
json.loads(raw_json)["useState"]["uniquePseudoAsyncDataStateKey"][
177+
"product"
178+
]
178179
if raw_json
179180
else None
180181
)

fixprice_api/endpoints/general.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Общий (не класифицируемый) функционал"""
22

3-
from typing import TYPE_CHECKING
43
from io import BytesIO
5-
from human_requests.abstraction import Proxy
6-
from aiohttp_retry import ExponentialRetry, RetryClient
4+
from typing import TYPE_CHECKING
75

6+
from aiohttp_retry import ExponentialRetry, RetryClient
87
from human_requests import ApiChild
8+
from human_requests.abstraction import Proxy
99

1010
if TYPE_CHECKING:
1111
from fixprice_api.manager import FixPriceAPI

fixprice_api/endpoints/geolocation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6-
from human_requests import autotest
7-
from human_requests.abstraction import FetchResponse, HttpMethod
86
from typing import TYPE_CHECKING
97

10-
from human_requests import ApiChild, ApiParent, api_child_field
8+
from human_requests import ApiChild, ApiParent, api_child_field, autotest
9+
from human_requests.abstraction import FetchResponse, HttpMethod
1110

1211
if TYPE_CHECKING:
1312
from fixprice_api.manager import FixPriceAPI

fixprice_api/manager.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
from typing import Any, Literal
2-
from dataclasses import dataclass, field
31
from collections import defaultdict
4-
from human_requests import HumanBrowser, HumanContext, HumanPage
5-
from human_requests.abstraction import Proxy, FetchResponse, HttpMethod
6-
from human_requests.network_analyzer.anomaly_sniffer import (
7-
HeaderAnomalySniffer,
8-
WaitHeader,
9-
WaitSource,
10-
)
2+
from dataclasses import dataclass, field
3+
from typing import Any, Literal
4+
115
from camoufox import AsyncCamoufox, DefaultAddons
6+
from human_requests import (ApiParent, HumanBrowser, HumanContext, HumanPage,
7+
api_child_field)
8+
from human_requests.abstraction import FetchResponse, HttpMethod, Proxy
9+
from human_requests.network_analyzer.anomaly_sniffer import (
10+
HeaderAnomalySniffer, WaitHeader, WaitSource)
1211

13-
from human_requests import ApiParent, api_child_field
14-
from .endpoints.catalog import ClassCatalog
15-
from .endpoints.geolocation import ClassGeolocation
1612
from .endpoints.advertising import ClassAdvertising
13+
from .endpoints.catalog import ClassCatalog
1714
from .endpoints.general import ClassGeneral
15+
from .endpoints.geolocation import ClassGeolocation
1816

1917

2018
@dataclass
@@ -76,7 +74,7 @@ async def _warmup(self) -> None:
7674
**self.browser_opts,
7775
block_images=True,
7876
i_know_what_im_doing=True,
79-
exclude_addons=[DefaultAddons.UBO]
77+
exclude_addons=[DefaultAddons.UBO],
8078
).start()
8179

8280
self.session = HumanBrowser.replace(br)
@@ -103,7 +101,9 @@ async def _warmup(self) -> None:
103101
)
104102

105103
if self.test_mode:
106-
btn = self.page.locator("div.selected-city > div.buttons > button.button.normal").first
104+
btn = self.page.locator(
105+
"div.selected-city > div.buttons > button.button.normal"
106+
).first
107107
await btn.wait_for(state="visible", timeout=self.timeout_ms)
108108
await btn.click(timeout=self.timeout_ms)
109109

tests/api_test.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
from typing import Any
22

33
import pytest
4+
from human_requests import (autotest_data, autotest_depends_on, autotest_hook,
5+
autotest_params)
6+
from human_requests.autotest import (AutotestCallContext, AutotestContext,
7+
AutotestDataContext)
8+
from PIL import Image
9+
410
from fixprice_api.endpoints.catalog import ClassCatalog, ProductService
511
from fixprice_api.endpoints.geolocation import ClassGeolocation
6-
from human_requests import (
7-
autotest_data,
8-
autotest_depends_on,
9-
autotest_hook,
10-
autotest_params,
11-
)
12-
from human_requests.autotest import (
13-
AutotestCallContext,
14-
AutotestContext,
15-
AutotestDataContext,
16-
)
17-
from PIL import Image
1812

1913

2014
@autotest_hook(target=ClassCatalog.tree)
@@ -115,6 +109,7 @@ def _product_info_params(ctx: AutotestCallContext) -> dict[str, str]:
115109
def _unstandard_headers_data(ctx: AutotestDataContext) -> dict[str, Any]:
116110
return ctx.api.unstandard_headers
117111

112+
118113
@autotest_data(name="unstandard_urls")
119114
def _unstandard_urls_data(ctx: AutotestDataContext) -> dict[str, Any]:
120115
return ctx.api.unstandard_urls

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from fixprice_api import FixPriceAPI
34

45

0 commit comments

Comments
 (0)