Conversation
|
The failing check is easy enough to fix, but I found a possible way to get around the Any and I need to test it, so I'll be a while. |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
srittau
left a comment
There was a problem hiding this comment.
Thanks, remarks below. Please note that I only left remarks on the first file, but they apply to all files.
stubs/lupa/lupa/lua51.pyi
Outdated
|
|
||
| # @classmethod | ||
| # def __cinit__(cls, unpack_return_tuples: bool) -> None: ... | ||
| def __init__(self, /, unpack_returned_tuples: bool, *args: Any) -> None: ... |
There was a problem hiding this comment.
Please note that we need a comment for each Any, explaining which types are allowed and/or how it's used.
stubs/lupa/lupa/lua51.pyi
Outdated
| LuaKey: TypeAlias = str | int | ||
| LuaObject: TypeAlias = _LuaTable | int | str | float | bool | None |
There was a problem hiding this comment.
As far as I understand, these are not available at runtime, so we need to preface them with an underscore.
You could also consider adding a lupa._types modules where you define these type-check only items and just import them, but that's just an option.
|
Apologies for sitting on this for so long. I got distracted by something shiny. I removed the |
This comment has been minimized.
This comment has been minimized.
Support get/set/del from Lua tables. Lua table values are all Any because we can't typecheck across language boundaries. Support unpack_returned_tuples in the LuaRuntime constructor. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Tue Jul 1 16:43:21 2025 -0700 # # On branch main # Your branch is ahead of 'origin/main' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: lua51.pyi # modified: lua52.pyi # modified: lua53.pyi # modified: lua54.pyi #
|
Diff from mypy_primer, showing the effect of this PR on open source code: discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/hybrid.py:508: error: Overlap between argument names and ** TypedDict items: "name", "description" [misc]
+ discord/ext/commands/hybrid.py:508: error: Overlap between argument names and ** TypedDict items: "description", "name" [misc]
- discord/ext/commands/hybrid.py:629: error: Overlap between argument names and ** TypedDict items: "name", "description" [misc]
+ discord/ext/commands/hybrid.py:629: error: Overlap between argument names and ** TypedDict items: "description", "name" [misc]
- discord/ext/commands/hybrid.py:834: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/hybrid.py:834: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
- discord/ext/commands/hybrid.py:858: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/hybrid.py:858: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
- discord/ext/commands/hybrid.py:883: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/hybrid.py:883: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
- discord/ext/commands/hybrid.py:935: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/hybrid.py:935: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
- discord/ext/commands/bot.py:291: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/bot.py:291: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
- discord/ext/commands/bot.py:315: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]
+ discord/ext/commands/bot.py:315: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]
|
|
That mypy note seems irrelevant to this PR (probably just irrelevant in general, but certainly not something we need to worry about here) |
This requires a change to the lupa and Pillow typing, which are both still pending (merged but not released). python/typeshed#14359 python-pillow/Pillow#9166
Support get/set/del from Lua tables.
Lua table values are all Any because we can't typecheck across language boundaries.
Support unpack_returned_tuples in the LuaRuntime constructor.