Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give mutable class attributes typing.ClassVar signatures #1497

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions interactions/client/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import sys
from collections import defaultdict
from importlib.metadata import version as _v, PackageNotFoundError
from typing import TypeVar, Union, Callable, Coroutine
from typing import TypeVar, Union, Callable, Coroutine, ClassVar

__all__ = (
"__version__",
Expand Down Expand Up @@ -131,7 +131,7 @@ def get_logger() -> logging.Logger:


class Singleton(type):
_instances = {}
_instances: ClassVar[dict] = {}

def __call__(self, *args, **kwargs) -> "Singleton":
if self not in self._instances:
Expand Down
6 changes: 3 additions & 3 deletions interactions/client/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any, TYPE_CHECKING, Callable, Coroutine, List, Optional, SupportsInt, Union
from typing import Dict, Any, TYPE_CHECKING, Callable, Coroutine, ClassVar, List, Optional, SupportsInt, Union

import aiohttp

Expand Down Expand Up @@ -201,7 +201,7 @@ class WebSocketClosed(LibraryException):
"""The websocket was closed."""

code: int = 0
codes: Dict[int, str] = {
codes: ClassVar[Dict[int, str]] = {
1000: "Normal Closure",
4000: "Unknown Error",
4001: "Unknown OpCode",
Expand All @@ -228,7 +228,7 @@ class VoiceWebSocketClosed(LibraryException):
"""The voice websocket was closed."""

code: int = 0
codes: Dict[int, str] = {
codes: ClassVar[Dict[int, str]] = {
1000: "Normal Closure",
4000: "Unknown Error",
4001: "Unknown OpCode",
Expand Down
3 changes: 2 additions & 1 deletion interactions/ext/debug_extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import platform
import tracemalloc
from typing import ClassVar

from interactions import (
Client,
Expand Down Expand Up @@ -28,7 +29,7 @@ class Metadata(Extension.Metadata):
description = "Debugging utilities for interactions.py"
version = "1.0.0"
url = "https://github.com/interactions-py/interactions.py"
requirements = ["interactions>=5.0.0"]
requirements: ClassVar[list] = ["interactions>=5.0.0"]

def __init__(self, bot: Client) -> None:
bot.logger.info("Debug Extension is mounting!")
Expand Down
Loading