Skip to content

Commit 16124ee

Browse files
committed
Resolve typing scope issues caused by changes to annotation resolution
1 parent 5f0e8d3 commit 16124ee

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

bot/exts/info/doc/_cog.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import defaultdict
55
from contextlib import suppress
66
from types import SimpleNamespace
7-
from typing import Literal, NamedTuple
7+
from typing import Literal
88

99
import aiohttp
1010
import discord
@@ -21,6 +21,7 @@
2121
from bot.utils.messages import send_denial, wait_for_deletion
2222

2323
from . import NAMESPACE, PRIORITY_PACKAGES, _batch_parser, doc_cache
24+
from ._doc_item import DocItem
2425
from ._inventory_parser import InvalidHeaderError, InventoryDict, fetch_inventory
2526

2627
log = get_logger(__name__)
@@ -41,21 +42,6 @@
4142
COMMAND_LOCK_SINGLETON = "inventory refresh"
4243

4344

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-
5945
class DocCog(commands.Cog):
6046
"""A set of commands for querying & displaying documentation."""
6147

bot/exts/info/doc/_doc_item.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from typing import NamedTuple
2+
3+
4+
class DocItem(NamedTuple):
5+
"""Holds inventory symbol information."""
6+
7+
package: str # Name of the package name the symbol is from
8+
group: str # Interpshinx "role" of the symbol, for example `label` or `method`
9+
base_url: str # Absolute path to to which the relative path resolves, same for all items with the same package
10+
relative_url_path: str # Relative path to the page where the symbol is located
11+
symbol_id: str # Fragment id used to locate the symbol on the page
12+
13+
@property
14+
def url(self) -> str:
15+
"""Return the absolute url to the symbol."""
16+
return self.base_url + self.relative_url_path

bot/exts/info/doc/_redis_cache.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import datetime
22
import fnmatch
33
import time
4-
from typing import TYPE_CHECKING
54

65
from async_rediscache.types.base import RedisObject
76

87
from bot.log import get_logger
98
from bot.utils.lock import lock
109

11-
if TYPE_CHECKING:
12-
from ._cog import DocItem
10+
from ._doc_item import DocItem
1311

1412
WEEK_SECONDS = int(datetime.timedelta(weeks=1).total_seconds())
1513

0 commit comments

Comments
 (0)