pydantic-pycharm-plugin
pydantic-pycharm-plugin copied to clipboard
Class property incorrectly parsed
Describe the bug @classmethod and @property combined can define a class property since Python 3.9. This is incorrectly parsed by the pydantic plugin.
To Reproduce
The parser will expect cls to be self.
from typing import ClassVar
from pydantic import BaseModel
class A(BaseModel):
a: ClassVar[int] = 4
@classmethod
@property
def test_prop(cls):
return cls.a
Expected behavior The syntax is correct, there should be no highlight.
Screenshots

Environments (please complete the following information): pydantic version: 1.8.2 pydantic compiled: True install path: /home/can/.cache/pypoetry/virtualenvs/bikipy-hzbIcTjf-py3.9/lib/python3.9/site-packages/pydantic python version: 3.9.9 (main, Dec 9 2021, 11:30:30) [GCC 11.1.0] platform: Linux-5.15.8-zen1-1-zen-x86_64-with-glibc2.33 optional deps. installed: ['typing-extensions']
@caniko
Thank you for creating this issue.
Is the problem related to the pydantic plugin?
I can reproduce the problem without pydantic.

no response :(
Yes, sorry, you are correct.