mirror of
https://github.com/etienne-hd/lbc.git
synced 2026-04-30 02:35:36 +02:00
refactor(lbc): modernize typing and exports across client and models
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Any
|
||||
from typing import Any
|
||||
|
||||
from .ad import Ad
|
||||
|
||||
|
||||
@dataclass
|
||||
class Search:
|
||||
total: int
|
||||
@@ -13,14 +14,11 @@ class Search:
|
||||
total_inactive: int
|
||||
total_shippable: int
|
||||
max_pages: int
|
||||
ads: List[Ad]
|
||||
ads: list[Ad]
|
||||
|
||||
@staticmethod
|
||||
def _build(raw: dict, client: Any) -> "Search":
|
||||
ads: List[Ad] = [
|
||||
Ad._build(raw=ad, client=client)
|
||||
for ad in raw.get("ads", [])
|
||||
]
|
||||
ads: list[Ad] = [Ad._build(raw=ad, client=client) for ad in raw.get("ads", [])]
|
||||
|
||||
return Search(
|
||||
total=raw.get("total"),
|
||||
@@ -32,4 +30,4 @@ class Search:
|
||||
total_shippable=raw.get("total_shippable"),
|
||||
max_pages=raw.get("max_pages"),
|
||||
ads=ads,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user