Skip to content

Commit

Permalink
✨ Add autocomplete support for VS Code, via dataclass_transform (py…
Browse files Browse the repository at this point in the history
…dantic#2721)

* ✨ Add autocomplete support for VS Code, via dataclass_transform

* 📝 Update changes

* 📝 Add docs for VS Code

* 📝 Clarify strict type error checks alternatives, include example with cast()

* ♻️ Update BaseSettings annotation to improve editor support

keeping editor support for BaseSetting's custom Config, but preventing __config__ from showing in constructor on editors supporting dataclass_transform

* 🎨 Remove unused type: ignore comment

* 🎨 Update type annotations for BaseSettings and BaseModel to use ClassVar where suitable

to improve editor support with type annotations and dataclass_transform

* 🎨 Apply ClassVars again

* 📝 Simplify VS Code docs terms

refer mainly to Pylance and clarify the relationship with Pyright

* 📝 Add link to Pylance FAQ

Co-authored-by: PrettyWood <em.jolibois@gmail.com>
  • Loading branch information
2 people authored and jpribyl committed Dec 4, 2021
1 parent 4bd8320 commit 9155e09
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions pydantic/main.py
Expand Up @@ -127,18 +127,6 @@ def hash_function(self_: Any) -> int:
_is_base_model_class_defined = False


_T = TypeVar('_T')


def __dataclass_transform__(
*,
eq_default: bool = True,
order_default: bool = False,
kw_only_default: bool = False,
field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()),
) -> Callable[[_T], _T]:
return lambda a: a

@__dataclass_transform__(kw_only_default=True, field_descriptors=(Field, FieldInfo))
class ModelMetaclass(ABCMeta):
@no_type_check # noqa C901
Expand Down

0 comments on commit 9155e09

Please sign in to comment.