Skip to content

Commit 9b98d14

Browse files
dmontagusamuelcolvin
authored andcommitted
Change return type hint for create_model (#526)
* Change return type hint for create_model, fix #525 * remove unnecessary ignore * Update HISTORY.rst
1 parent fe72ba1 commit 9b98d14

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

HISTORY.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ v0.26 (unreleased)
77
..................
88
* fix to schema generation for ``IPvAnyAddress``, ``IPvAnyInterface``, ``IPvAnyNetwork`` #498 by @pilosus
99
* fix variable length tuples support, #495 by @pilosus
10+
* fix return type hint for ``create_model``, #526 by @dmontagu
1011

1112
v0.25 (2019-05-05)
1213
..................

pydantic/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def create_model( # noqa: C901 (ignore complexity)
526526
__module__: Optional[str] = None,
527527
__validators__: Dict[str, classmethod] = None,
528528
**field_definitions: Any,
529-
) -> BaseModel:
529+
) -> Type[BaseModel]:
530530
"""
531531
Dynamically create a model.
532532
:param model_name: name of the created model
@@ -571,7 +571,7 @@ def create_model( # noqa: C901 (ignore complexity)
571571
if __config__:
572572
namespace['Config'] = inherit_config(__config__, BaseConfig)
573573

574-
return type(model_name, (__base__,), namespace) # type: ignore
574+
return type(model_name, (__base__,), namespace)
575575

576576

577577
def validate_model( # noqa: C901 (ignore complexity)

0 commit comments

Comments
 (0)