| 244 | |
| 245 | |
| 246 | async def _gen_ct_bindings() -> dict[str, list[str]]: |
| 247 | params: dict[str, list[str]] = {} |
| 248 | |
| 249 | out: str = "\n\n" |
| 250 | async with aiohttp.ClientSession() as s: |
| 251 | async with s.get(f"{BASE_URL}/stable.html#stable-application-binary-interface") as resp: |
| 252 | soup = BeautifulSoup(await resp.text(), features="html.parser") |
| 253 | ul = soup.find("ul", attrs={"class": "simple"}) |
| 254 | assert ul |
| 255 | |
| 256 | for tag in ul: |
| 257 | if not isinstance(tag, Tag): |
| 258 | continue |
| 259 | |
| 260 | p = tag.find("p", recursive=True) |
| 261 | assert p |
| 262 | a = p.find("a") |
| 263 | |
| 264 | if a: |
| 265 | assert type(a) is Tag |
| 266 | name: str = a.get_text().replace("()", "") |
| 267 | href = a.attrs["href"] |
| 268 | path = href[: href.find(".html")] |
| 269 | |
| 270 | if path not in PAGES: |
| 271 | print("Loading page... ", path) |
| 272 | PAGES[path] = BeautifulSoup( |
| 273 | requests.get(f"{BASE_URL}/{path}.html").text, |
| 274 | features="html.parser", |
| 275 | ) |
| 276 | |
| 277 | page = PAGES[path] |
| 278 | signature: str = "" |
| 279 | doc = page.find(id=f"c.{name}") |
| 280 | assert doc, f"{page} {name}" |
| 281 | |
| 282 | for tg in doc: |
| 283 | if isinstance(tg, str): |
| 284 | signature += tg if tg != "\n" else "" |
| 285 | continue |
| 286 | |
| 287 | text: str = tg.get_text() |
| 288 | if text != "¶": |
| 289 | signature += text |
| 290 | |
| 291 | assert type(doc) is Tag |
| 292 | parent = doc.parent |
| 293 | assert parent |
| 294 | |
| 295 | minver_soup = parent.find( |
| 296 | "span", |
| 297 | attrs={"class": "versionmodified added"}, |
| 298 | recursive=True, |
| 299 | ) |
| 300 | minver: str | None = None |
| 301 | |
| 302 | if minver_soup: |
| 303 | minver = minver_soup.get_text()[:-1].split(" ")[-1] |