|
4 | 4 | from collections import defaultdict |
5 | 5 | from contextlib import suppress |
6 | 6 | from types import SimpleNamespace |
7 | | -from typing import Literal, NamedTuple |
| 7 | +from typing import Literal |
8 | 8 |
|
9 | 9 | import aiohttp |
10 | 10 | import discord |
|
21 | 21 | from bot.utils.messages import send_denial, wait_for_deletion |
22 | 22 |
|
23 | 23 | from . import NAMESPACE, PRIORITY_PACKAGES, _batch_parser, doc_cache |
| 24 | +from ._doc_item import DocItem |
24 | 25 | from ._inventory_parser import InvalidHeaderError, InventoryDict, fetch_inventory |
25 | 26 |
|
26 | 27 | log = get_logger(__name__) |
|
41 | 42 | COMMAND_LOCK_SINGLETON = "inventory refresh" |
42 | 43 |
|
43 | 44 |
|
44 | | -class DocItem(NamedTuple): |
45 | | - """Holds inventory symbol information.""" |
46 | | - |
47 | | - package: str # Name of the package name the symbol is from |
48 | | - group: str # Interpshinx "role" of the symbol, for example `label` or `method` |
49 | | - base_url: str # Absolute path to to which the relative path resolves, same for all items with the same package |
50 | | - relative_url_path: str # Relative path to the page where the symbol is located |
51 | | - symbol_id: str # Fragment id used to locate the symbol on the page |
52 | | - |
53 | | - @property |
54 | | - def url(self) -> str: |
55 | | - """Return the absolute url to the symbol.""" |
56 | | - return self.base_url + self.relative_url_path |
57 | | - |
58 | | - |
59 | 45 | class DocCog(commands.Cog): |
60 | 46 | """A set of commands for querying & displaying documentation.""" |
61 | 47 |
|
|
0 commit comments