Open earthpyy opened 2 years ago
@earthpyy Thank you for reporting this issue. I don't expect the parrtern. I will fix it.
@earthpyy Thank you for reporting this issue. I don't expect the parrtern. I will fix it.
@koxudaxi Thanks very much! Also thanks for this great work as well!
@earthpyy I'm sorry for my late reply. I can't reproduce your warning.
Would you please give me the code?
@koxudaxi Hello, I just tried to reproduce and found that the import statement was import pydantic.generics
instead of import pydantic
. I think because the other place in the same file was using pydantic.generics.Generic
.
I also found that it isn't practical to import like that and using pydantic.validator
later. Changing the import statement back to import pydantic
works. I'm not sure if there is anything to fix in this case. Thanks!
That's good news. I'm happy to resolve your problem.
I don't close this issue now. If I get the time then I will check the problem deeply.
Thanks for your help!
Describe the bug PyCharm is not seeing
validator
function as a class method when using@pydantic.validator
instead of@validator
To Reproduce Steps to reproduce the behavior:
@pydantic.validator(...)
as a decorator instead of using@validator(...)
Expected behavior PyCharm should not warn about using
self
insteadcls
sincevalidator()
returns class methodScreenshots![image](https://user-images.githubusercontent.com/5132475/125607401-20b5679b-ba99-4522-a831-2ff127b1de25.png)
Environments (please complete the following information):
Additional context None