pysonar_demo/feed.pyStatic analysis
Awaitable calls, awaited result types, and data normalization.10 definitions19 references
1 """Async examples for modern Python AST navigation.""" 2 3 from .models import Market 4 5 6 class MarketFeed: 7 async def fetch(self) -> list[dict]: 8 return [ 9 {"question": "Example market", "yes_price": 0.58, "volume": 32000}, 10 ] 11 12 13 async def refresh(feed: MarketFeed) -> list[Market]: 14 payloads = await feed.fetch() 15 markets: list[Market] = [] 16 for payload in payloads: 17 markets.append( 18 Market(payload["question"], payload["yes_price"], payload["volume"]) 19 ) 20 return markets