Skip to content

Commit b918f97

Browse files
committed
chore: Run pyupgrade --py310-plus on codebase
1 parent c5b25c0 commit b918f97

59 files changed

Lines changed: 129 additions & 137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

discord/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import platform
2929
import sys
3030
from pathlib import Path
31-
from typing import Tuple
3231

3332
import aiohttp
3433

@@ -352,7 +351,7 @@ def add_newcog_args(subparser: argparse._SubParsersAction) -> None:
352351
)
353352

354353

355-
def parse_args() -> Tuple[argparse.ArgumentParser, argparse.Namespace]:
354+
def parse_args() -> tuple[argparse.ArgumentParser, argparse.Namespace]:
356355
parser = argparse.ArgumentParser(
357356
prog="discord", description="Tools for helping with Pycord"
358357
)

discord/abc.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@
2828
import asyncio
2929
import copy
3030
import time
31+
from collections.abc import Callable, Iterable, Sequence
3132
from typing import (
3233
TYPE_CHECKING,
3334
Any,
34-
Callable,
35-
Iterable,
3635
Protocol,
37-
Sequence,
3836
TypeVar,
3937
Union,
4038
overload,

discord/audit_logs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
from __future__ import annotations
2727

2828
import datetime
29+
from collections.abc import Callable, Generator
2930
from functools import cached_property
30-
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generator, TypeVar
31+
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar
3132

3233
from . import enums, utils
3334
from .asset import Asset

discord/backoff.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828
import random
2929
import time
30-
from typing import Callable, Generic, Literal, TypeVar, overload
30+
from collections.abc import Callable
31+
from typing import Generic, Literal, TypeVar, overload
3132

3233
T = TypeVar("T", bool, Literal[True], Literal[False])
3334

discord/bot.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@
3434
import sys
3535
import traceback
3636
from abc import ABC, abstractmethod
37+
from collections.abc import Callable, Coroutine, Generator, Mapping
3738
from typing import (
3839
TYPE_CHECKING,
3940
Any,
40-
Callable,
41-
Coroutine,
42-
Generator,
4341
Literal,
44-
Mapping,
4542
TypeVar,
4643
)
4744

discord/channel.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
from __future__ import annotations
2727

2828
import datetime
29+
from collections.abc import Callable, Iterable, Mapping, Sequence
2930
from typing import (
3031
TYPE_CHECKING,
3132
Any,
32-
Callable,
33-
Iterable,
34-
Mapping,
3533
NamedTuple,
36-
Sequence,
3734
TypeVar,
3835
overload,
3936
)

discord/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@
3030
import signal
3131
import sys
3232
import traceback
33+
from collections.abc import Callable, Coroutine, Generator, Sequence
3334
from types import TracebackType
3435
from typing import (
3536
TYPE_CHECKING,
3637
Any,
37-
Callable,
38-
Coroutine,
39-
Generator,
40-
Sequence,
4138
TypeVar,
4239
)
4340

discord/cog.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,16 @@
3131
import pathlib
3232
import sys
3333
import types
34-
from collections.abc import Generator, Mapping
34+
from collections.abc import Callable, Generator, Mapping
3535
from typing import (
3636
TYPE_CHECKING,
3737
Any,
38-
Callable,
3938
ClassVar,
39+
TypeGuard,
4040
TypeVar,
4141
overload,
4242
)
4343

44-
from typing_extensions import TypeGuard
45-
4644
import discord.utils
4745

4846
from . import errors

discord/commands/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from discord.webhook.async_ import Webhook
3333

3434
if TYPE_CHECKING:
35-
from typing import Awaitable, Callable
35+
from collections.abc import Awaitable, Callable
3636

3737
from typing_extensions import ParamSpec
3838

discord/commands/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@
3333
import sys
3434
import types
3535
from collections import OrderedDict
36+
from collections.abc import Callable, Coroutine, Generator
3637
from enum import Enum
3738
from typing import (
3839
TYPE_CHECKING,
3940
Any,
40-
Callable,
41-
Coroutine,
42-
Generator,
4341
Generic,
4442
TypeVar,
4543
Union,
@@ -72,7 +70,7 @@
7270
if sys.version_info >= (3, 11):
7371
from typing import Annotated, Literal, get_args, get_origin
7472
else:
75-
from typing_extensions import Annotated, Literal, get_args, get_origin
73+
from typing import Annotated, Literal, get_args, get_origin
7674

7775
__all__ = (
7876
"_BaseCommand",
@@ -90,7 +88,9 @@
9088
)
9189

9290
if TYPE_CHECKING:
93-
from typing_extensions import Concatenate, ParamSpec
91+
from typing import Concatenate
92+
93+
from typing_extensions import ParamSpec
9494

9595
from .. import Permissions
9696
from ..cog import Cog

0 commit comments

Comments
 (0)