Skip to content

Change CheckDecorator type#94

Open
PythonCoderAS wants to merge 1 commit intobryanforbes:masterfrom
PythonCoderAS:patch-2
Open

Change CheckDecorator type#94
PythonCoderAS wants to merge 1 commit intobryanforbes:masterfrom
PythonCoderAS:patch-2

Conversation

@PythonCoderAS
Copy link
Copy Markdown
Contributor

The decorator returned by check() has an attribute, predicate, that is relied upon by check_any(). Therefore, a check decorator cannot just be anything that returns a function but must include this attribute as well. check_any() also relies on this attribute, which is not present in _CheckPredicate.

The decorator returned by `check()` has an attribute, `predicate`, that is relied upon by `check_any()`. Therefore, a check decorator cannot just be anything that returns a function but must include this attribute as well. `check_any()` also relies on this attribute, which is not present in `_CheckPredicate`.
@type_check_only
class _CheckDecorator(Protocol):
class _CheckDecorator:
predicate: _CheckPredicate[_CT]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

To keep _CheckDecorator so it's not generic, _CT needs to be chaned to Any here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Would it be reasonable to set discord.ext.commands.Context, since that will always be a Context instance?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants