2222from faceit .models .custom_types import TimestampMs
2323
2424if typing .TYPE_CHECKING :
25- from faceit .types import RawAPIItem , RawAPIPageResponse
25+ from faceit .types import RawAPIPageResponse
2626
2727
2828class _DummyResource (
@@ -41,9 +41,7 @@ def raw_method(
4141 offset : int = Field (0 , ge = 0 ),
4242 limit : int = Field (2 , ge = 1 , le = 2 ),
4343 ) -> RawAPIPageResponse :
44- items = typing .cast (
45- "typing.List[RawAPIItem]" , self ._items [offset : offset + limit ]
46- )
44+ items = self ._items [offset : offset + limit ]
4745 return {"items" : items , "start" : offset , "end" : offset + limit }
4846
4947 async def async_raw_method (
@@ -67,9 +65,7 @@ def raw_method_with_unix(
6765 if to is None
6866 else [item for item in self ._items if item ["finished_at" ] < to ]
6967 )
70- items = typing .cast (
71- "typing.List[RawAPIItem]" , filtered [offset : offset + limit ]
72- )
68+ items = filtered [offset : offset + limit ]
7369 return {"items" : items , "start" : offset , "end" : offset + limit }
7470
7571 async def async_raw_method_with_unix (
@@ -108,22 +104,8 @@ def dummy_resource(
108104@pytest .fixture
109105def raw_pages () -> typing .Tuple [RawAPIPageResponse , RawAPIPageResponse ]:
110106 return (
111- {
112- "items" : [
113- typing .cast ("RawAPIItem" , {"id" : "a" }),
114- typing .cast ("RawAPIItem" , {"id" : "b" }),
115- ],
116- "start" : 0 ,
117- "end" : 2 ,
118- },
119- {
120- "items" : [
121- typing .cast ("RawAPIItem" , {"id" : "b" }),
122- typing .cast ("RawAPIItem" , {"id" : "c" }),
123- ],
124- "start" : 2 ,
125- "end" : 4 ,
126- },
107+ {"items" : [{"id" : "a" }, {"id" : "b" }], "start" : 0 , "end" : 2 },
108+ {"items" : [{"id" : "b" }, {"id" : "c" }], "start" : 2 , "end" : 4 },
127109 )
128110
129111
@@ -177,10 +159,8 @@ def test_extract_unix_timestamp_from_raw_page() -> None:
177159 second_item_timestamp = 200
178160 page : RawAPIPageResponse = {
179161 "items" : [
180- typing .cast ("RawAPIItem" , {"stats" : {"Match Finished At" : 100 }}),
181- typing .cast (
182- "RawAPIItem" , {"stats" : {"Match Finished At" : second_item_timestamp }}
183- ),
162+ {"stats" : {"Match Finished At" : 100 }},
163+ {"stats" : {"Match Finished At" : second_item_timestamp }},
184164 ],
185165 "start" : 0 ,
186166 "end" : 2 ,
@@ -280,16 +260,8 @@ def test_sync_iterator_collect_respects_safe_max_items(
280260
281261async def test_async_gather_from_iterator_raw () -> None :
282262 async def source () -> typing .AsyncIterator [RawAPIPageResponse ]: # noqa: RUF029
283- yield {
284- "items" : [typing .cast ("RawAPIItem" , {"id" : 1 })],
285- "start" : 0 ,
286- "end" : 1 ,
287- }
288- yield {
289- "items" : [typing .cast ("RawAPIItem" , {"id" : 2 })],
290- "start" : 1 ,
291- "end" : 2 ,
292- }
263+ yield {"items" : [{"id" : 1 }], "start" : 0 , "end" : 1 }
264+ yield {"items" : [{"id" : 2 }], "start" : 1 , "end" : 2 }
293265
294266 result = await AsyncPageIterator .gather_from_iterator (
295267 source (),
0 commit comments