Skip to content

Conversation

@onerandomusername
Copy link
Member

Summary

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running uv run nox -s lint
    • I have type-checked the code by running uv run nox -s pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@read-the-docs-community
Copy link

read-the-docs-community bot commented Oct 20, 2025

Documentation build overview

📚 disnake | 🛠️ Build #30001965 | 📁 Comparing 1ebea09 against latest (a9d45ed)


🔍 Preview build

Show files changed (48 files in total): 📝 48 modified | ➕ 0 added | ➖ 0 deleted
File Status
index.html 📝 modified
whats_new.html 📝 modified
api/abc.html 📝 modified
api/activities.html 📝 modified
api/app_commands.html 📝 modified
api/app_info.html 📝 modified
api/audit_logs.html 📝 modified
api/automod.html 📝 modified
api/channels.html 📝 modified
api/clients.html 📝 modified
api/components.html 📝 modified
api/emoji.html 📝 modified
api/entitlements.html 📝 modified
api/events.html 📝 modified
api/exceptions.html 📝 modified
api/guild_scheduled_events.html 📝 modified
api/guilds.html 📝 modified
api/integrations.html 📝 modified
api/interactions.html 📝 modified
api/invites.html 📝 modified
api/localization.html 📝 modified
api/members.html 📝 modified
api/messages.html 📝 modified
api/misc.html 📝 modified
api/permissions.html 📝 modified
api/roles.html 📝 modified
api/skus.html 📝 modified
api/soundboard.html 📝 modified
api/stage_instances.html 📝 modified
api/stickers.html 📝 modified
api/subscriptions.html 📝 modified
api/ui.html 📝 modified
api/users.html 📝 modified
api/utilities.html 📝 modified
api/voice.html 📝 modified
api/webhooks.html 📝 modified
api/widgets.html 📝 modified
ext/tasks/index.html 📝 modified
ext/commands/api/app_commands.html 📝 modified
ext/commands/api/bots.html 📝 modified
ext/commands/api/checks.html 📝 modified
ext/commands/api/cogs.html 📝 modified
ext/commands/api/context.html 📝 modified
ext/commands/api/converters.html 📝 modified
ext/commands/api/exceptions.html 📝 modified
ext/commands/api/help_commands.html 📝 modified
ext/commands/api/misc.html 📝 modified
ext/commands/api/prefix_commands.html 📝 modified

@onerandomusername
Copy link
Member Author

Partially blocked by python/cpython#140348, though we can revert those aspects.

@onerandomusername
Copy link
Member Author

We should probably revert a portion of d602ba0 with regards to Union | str not working on 3.14 as it currently stands.

@onerandomusername onerandomusername marked this pull request as ready for review October 20, 2025 06:37
@Enegg
Copy link
Contributor

Enegg commented Oct 20, 2025

We should probably revert a portion of d602ba0 with regards to Union | str not working on 3.14 as it currently stands.

Alternatively, we could stringify those unions.

MessageableChannel: TypeAlias = GuildMessageable | DMChannel | GroupChannel | PartialMessageable
# include non-messageable channels, e.g. category/forum
AnyChannel = Union[MessageableChannel, AnyGuildChannel]
AnyChannel: TypeAlias = MessageableChannel | AnyGuildChannel
Copy link
Member

@shiftinv shiftinv Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to explicitly use TypeAlias for unions like this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruff doesn't detect they're unions and therefore doesn't autofix them :^)

@@ -1,5 +1,6 @@
# SPDX-License-Identifier: MIT


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -1,5 +1,6 @@
# SPDX-License-Identifier: MIT


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -1,3 +1,4 @@
# SPDX-License-Identifier: MIT


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +779 to +780
("int | float", Union[int, float], True), # noqa: UP007
("int | float", int | float, True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("int | float", Union[int, float], True), # noqa: UP007
("int | float", int | float, True),
("int | float", int | float, True),

Since this one is testing the 3.10 union syntax, I think it's the only one where we don't necessarily need both test cases

Comment on lines +823 to +831
@pytest.mark.parametrize(
"typehint",
[
Union[int, str], # noqa: UP007
int | str,
],
)
def test_forwardref_local(self, typehint) -> None:
IntOrStr = typehint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@pytest.mark.parametrize(
"typehint",
[
Union[int, str], # noqa: UP007
int | str,
],
)
def test_forwardref_local(self, typehint) -> None:
IntOrStr = typehint
def test_forwardref_local(self) -> None:
IntOrStr = int | str

The point of this test isn't unions, it was more of a means to an end; we can simply use the new syntax here.

Comment on lines +844 to +852
@pytest.mark.parametrize(
"typehint",
[
Union[int, str], # noqa: UP007
int | str,
],
)
def test_forwardref_mixed(self, typehint) -> None:
LocalIntOrStr = typehint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here:

Suggested change
@pytest.mark.parametrize(
"typehint",
[
Union[int, str], # noqa: UP007
int | str,
],
)
def test_forwardref_mixed(self, typehint) -> None:
LocalIntOrStr = typehint
def test_forwardref_mixed(self) -> None:
LocalIntOrStr = int | str

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news t: refactor/typing/lint Refactors, typing changes and/or linting changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants