mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Fix mypy plugin issue with self field (#2743)
* Fix mypy issue with self field * Add docs
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fix mypy plugin issue with self field declaration.
|
||||
+1
-1
@@ -619,7 +619,7 @@ def add_method(
|
||||
# first = []
|
||||
else:
|
||||
self_type = self_type or fill_typevars(info)
|
||||
first = [Argument(Var('self'), self_type, None, ARG_POS)]
|
||||
first = [Argument(Var('__pydantic_self__'), self_type, None, ARG_POS)]
|
||||
args = first + args
|
||||
arg_types, arg_names, arg_kinds = [], [], []
|
||||
for arg in args:
|
||||
|
||||
@@ -158,3 +158,7 @@ class NotFrozenModel(FrozenModel):
|
||||
|
||||
NotFrozenModel(x=1).x = 2
|
||||
NotFrozenModel.from_orm(model)
|
||||
|
||||
|
||||
class ModelWithSelfField(BaseModel):
|
||||
self: str
|
||||
|
||||
Reference in New Issue
Block a user