Skip to content

Commit

Permalink
chore: move mutable class ref/attrs to ClassVar typing (#1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
i0bs authored Jul 20, 2023
1 parent 579de0e commit fcb9dc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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

0 comments on commit fcb9dc6

Please sign in to comment.