Open danjones1618 opened 5 months ago
Hi @danjones1618 thanks for using flake8-builtins
and even more to take the time to report issues about it! 👍🏾
Oh, I see, indeed, that's a problematic corner case.
I myself do not use the typing
module or typing in general unfortunately.
You have, at least 3 options:
PaginationDict = TypeDict('PaginationDict', {'prev': Optional[str], 'next': Optional[str]})
Unfortunately I myself don't have much time free as of late...
I've drafted a PR to start to fix this in #128 .
There is an edge case I foresee which will always raise a false positive.
This is when the developer inhertis from a TypedDict
that is defined in another file as we won't be able to derrive the inheritence tree. I think this is a fair edge case to not handle.
The implementation I drafted does not resolve inheritence at the moment.
There is a seperate issue that comes to mind: it should validate that the TypedDict
you inherit from does in fact come from the typing
module.
When using with a TypeDict like:
This will incorrectly flag:
A003 class attribute "next" is shadowing a Python builtin
These checks should be disabled when a class inherits from
TypedDict