style: enable more pyright rules#1441
Conversation
| id: int = 0, | ||
| row: Optional[int] = None, | ||
| ) -> None: ... | ||
|
|
There was a problem hiding this comment.
Removing those should only be done once V_co TypeVar is changed to have a default.
There was a problem hiding this comment.
Going to try to convert as many of these as I can to have a default. Moving this to draft for now. Will return to this PR later.
1360d1e to
526ef70
Compare
058e876 to
38f2b66
Compare
Add in reportInconsistentOverload and reportInvalidTypeVarUse
| ) | ||
| else: | ||
| P = TypeVar("P") | ||
| BotT = TypeVar("BotT", bound="Union[Bot, AutoShardedBot]") |
There was a problem hiding this comment.
There's no real need to specify anything but the TypeVar's name in the else branch of TYPE_CHECKING
| BotT = TypeVar("BotT", bound="Union[Bot, AutoShardedBot]") | |
| BotT = TypeVar("BotT") |
| CogT = TypeVar("CogT", bound="Optional[Cog]") | ||
| ContextT = TypeVar("ContextT", bound="Context") |
There was a problem hiding this comment.
https://github.com/DisnakeDev/disnake/pull/1441/files#r2443495659
| CogT = TypeVar("CogT", bound="Optional[Cog]") | |
| ContextT = TypeVar("ContextT", bound="Context") | |
| CogT = TypeVar("CogT") | |
| ContextT = TypeVar("ContextT") |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | ||
| else: | ||
| ParamSpec = TypeVar | ||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) |
There was a problem hiding this comment.
https://github.com/DisnakeDev/disnake/pull/1441/files#r2443495659
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | |
| V_co = TypeVar("V_co") |
| from ..item import ItemCallbackType | ||
| from ..view import View | ||
|
|
||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) |
There was a problem hiding this comment.
The current behavior is to default to None
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=None) |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | ||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | ||
| else: | ||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) |
There was a problem hiding this comment.
https://github.com/DisnakeDev/disnake/pull/1441/files#r2443495659
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | |
| V_co = TypeVar("V_co") |
| from .item import ItemCallbackType | ||
| from .view import View | ||
|
|
||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) |
There was a problem hiding this comment.
https://github.com/DisnakeDev/disnake/pull/1441/files#r2443498907
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=None) |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | ||
| else: | ||
| ParamSpec = TypeVar | ||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) |
There was a problem hiding this comment.
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | |
| V_co = TypeVar("V_co") |
| from ..types.components import ActionRowChildComponent as ActionRowChildComponentPayload | ||
| from .view import View | ||
|
|
||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) |
There was a problem hiding this comment.
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=Optional[View]) | |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=None) |
| I = TypeVar("I", bound="Item[Any]") # noqa: E741 | ||
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | ||
|
|
||
| SelfViewT = TypeVar("SelfViewT", bound="Optional[View]") |
There was a problem hiding this comment.
| I = TypeVar("I", bound="Item[Any]") # noqa: E741 | |
| V_co = TypeVar("V_co", bound="Optional[View]", covariant=True) | |
| SelfViewT = TypeVar("SelfViewT", bound="Optional[View]") | |
| I = TypeVar("I") # noqa: E741 | |
| V_co = TypeVar("V_co") | |
| SelfViewT = TypeVar("SelfViewT") |
| def __iter__(cls) -> Iterator[EnumMeta]: | ||
| return (cls._enum_member_map_[name] for name in cls._enum_member_names_) | ||
|
|
||
| def __reversed__(cls) -> Iterator[EnumMetaT]: | ||
| def __reversed__(cls) -> Iterator[EnumMeta]: |
There was a problem hiding this comment.
These should be EnumMetaT, before you rebased the TypeVar was incorrectly bound to type[EnumMeta]
|
@Enegg thank you for taking a look! Yea, I know a lot of things here are shifted around. This PR is not ready to be looked at anymore. Yes, there are a bunch of incorrect things in here. Will get to patching things up as they come up. To be able to properly resolve some of the type errors, I need to resolve a bunch of |
|
Going to wait for #1449 before I work on this more. Also, after talking with @onerandomusername, I am going to move |
Note
DO NOT REVIEW THIS. This is very much WIP. Will remove this note when ready to be reviewed.
Summary
Add in reportInconsistentOverload and reportInvalidTypeVarUse pyright rules
Closes #1440
Was actually pretty quick to put this together. So it wasn't wasted work, even if you disagree with this PR.
But as stated in the issue; these overloads were not doing anything anyway. The generic should be provided in the class instead of left as an
Unknown. And maybe I am misunderstanding the code. If so, please let me know why this change is wrong.Updated the docs files because nox was complaining about deprecated usage.
These changes should all be a noop.
Checklist
uv run nox -s lintuv run nox -s pyright