aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-10-30 22:32:01 +0000
committerGravatar Joe Banks <[email protected]>2025-11-10 18:41:30 +0000
commit00f5c5813bbc0bae0ebdd8d9c48395cab5a408c3 (patch)
tree196403758fb58fb41127a14a3507fc4c0ec1796f
parentRemove unnecessary __future__.annotations imports (diff)
Resolve typing scope issues caused by changes to annotation resolution
-rw-r--r--bot/exts/info/doc/_cog.py18
-rw-r--r--bot/exts/info/doc/_doc_item.py16
-rw-r--r--bot/exts/info/doc/_redis_cache.py4
3 files changed, 19 insertions, 19 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index 271c83fff..bf27da4ab 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -4,7 +4,7 @@ import textwrap
from collections import defaultdict
from contextlib import suppress
from types import SimpleNamespace
-from typing import Literal, NamedTuple
+from typing import Literal
import aiohttp
import discord
@@ -21,6 +21,7 @@ from bot.utils.lock import SharedEvent, lock
from bot.utils.messages import send_denial, wait_for_deletion
from . import NAMESPACE, PRIORITY_PACKAGES, _batch_parser, doc_cache
+from ._doc_item import DocItem
from ._inventory_parser import InvalidHeaderError, InventoryDict, fetch_inventory
log = get_logger(__name__)
@@ -41,21 +42,6 @@ FETCH_RESCHEDULE_DELAY = SimpleNamespace(first=2, repeated=5)
COMMAND_LOCK_SINGLETON = "inventory refresh"
-class DocItem(NamedTuple):
- """Holds inventory symbol information."""
-
- package: str # Name of the package name the symbol is from
- group: str # Interpshinx "role" of the symbol, for example `label` or `method`
- base_url: str # Absolute path to to which the relative path resolves, same for all items with the same package
- relative_url_path: str # Relative path to the page where the symbol is located
- symbol_id: str # Fragment id used to locate the symbol on the page
-
- @property
- def url(self) -> str:
- """Return the absolute url to the symbol."""
- return self.base_url + self.relative_url_path
-
-
class DocCog(commands.Cog):
"""A set of commands for querying & displaying documentation."""
diff --git a/bot/exts/info/doc/_doc_item.py b/bot/exts/info/doc/_doc_item.py
new file mode 100644
index 000000000..a87b80efa
--- /dev/null
+++ b/bot/exts/info/doc/_doc_item.py
@@ -0,0 +1,16 @@
+from typing import NamedTuple
+
+
+class DocItem(NamedTuple):
+ """Holds inventory symbol information."""
+
+ package: str # Name of the package name the symbol is from
+ group: str # Interpshinx "role" of the symbol, for example `label` or `method`
+ base_url: str # Absolute path to to which the relative path resolves, same for all items with the same package
+ relative_url_path: str # Relative path to the page where the symbol is located
+ symbol_id: str # Fragment id used to locate the symbol on the page
+
+ @property
+ def url(self) -> str:
+ """Return the absolute url to the symbol."""
+ return self.base_url + self.relative_url_path
diff --git a/bot/exts/info/doc/_redis_cache.py b/bot/exts/info/doc/_redis_cache.py
index 72445897b..95003dab2 100644
--- a/bot/exts/info/doc/_redis_cache.py
+++ b/bot/exts/info/doc/_redis_cache.py
@@ -1,15 +1,13 @@
import datetime
import fnmatch
import time
-from typing import TYPE_CHECKING
from async_rediscache.types.base import RedisObject
from bot.log import get_logger
from bot.utils.lock import lock
-if TYPE_CHECKING:
- from ._cog import DocItem
+from ._doc_item import DocItem
WEEK_SECONDS = int(datetime.timedelta(weeks=1).total_seconds())