Skip to content

Commit

Permalink
fix: replace pipe unions with typing.Union
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharp-Eyes committed Sep 19, 2024
1 parent cd2071b commit 4cefda8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/source/extensions/custom_documenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def can_document_member(
) -> bool:
return isinstance(member, enum.EnumMeta) and not issubclass(member, enum.Flag)

def add_content(self, more_content: autodoc.StringList | None) -> None:
def add_content(self, more_content: typing.Optional[autodoc.StringList]) -> None:
super().add_content(more_content)

source_name = self.get_sourcename()
Expand Down
9 changes: 6 additions & 3 deletions src/disnake/ext/components/impl/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,18 @@ async def parse_message_components(
# Identifier and component: function call, return component
@typing.overload
def register(
self, component_type: typing.Type[ComponentT], *, identifier: str | None = None
self,
component_type: typing.Type[ComponentT],
*,
identifier: typing.Optional[str] = None,
) -> typing.Type[ComponentT]:
...

# Only identifier: nested decorator, return callable that registers and
# returns the component.
@typing.overload
def register(
self, *, identifier: str | None = None
self, *, identifier: typing.Optional[str] = None
) -> typing.Callable[[typing.Type[ComponentT]], typing.Type[ComponentT]]:
...

Expand Down Expand Up @@ -949,7 +952,7 @@ def make_select( # noqa: PLR0913
identifier: str,
*,
as_root: bool = True,
placeholder: omit.Omissible[str | None] = omit.Omitted,
placeholder: omit.Omissible[typing.Optional[str]] = omit.Omitted,
min_values: omit.Omissible[int] = omit.Omitted,
max_values: omit.Omissible[int] = omit.Omitted,
disabled: omit.Omissible[bool] = omit.Omitted,
Expand Down
6 changes: 3 additions & 3 deletions src/disnake/ext/components/impl/parser/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class DatetimeParser(parser_base.Parser[datetime.datetime]):
"""

resolution: int | float
resolution: typing.Union[int, float]
r"""The resolution with which to store :class:`~datetime.datetime`\s in seconds.
.. warning::
Expand Down Expand Up @@ -478,7 +478,7 @@ class DatetimeParser(parser_base.Parser[datetime.datetime]):
def __init__(
self,
*,
resolution: int | float = Resolution.SECONDS,
resolution: typing.Union[int, float] = Resolution.SECONDS,
timezone: datetime.timezone = datetime.timezone.utc,
strict: bool = True,
int_parser: typing.Optional[IntParser] = None,
Expand Down Expand Up @@ -626,7 +626,7 @@ class TimeParser(parser_base.Parser[datetime.time]):
"""

resolution: int | float
resolution: typing.Union[int, float]
r"""The resolution with which to store :class:`~datetime.time`\s in seconds.
.. warning::
Expand Down

0 comments on commit 4cefda8

Please sign in to comment.