Skip to content

Commit

Permalink
Prefer is_none_type() over type_ is NoneType
Browse files Browse the repository at this point in the history
  • Loading branch information
tharradine committed Dec 7, 2021
1 parent 76666a2 commit 0297d99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pydantic/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,11 @@ def _type_analysis(self) -> None: # noqa: C901 (ignore complexity)
if is_union_origin(origin):
types_ = []
for type_ in get_args(self.type_):
if type_ is NoneType or type_ is Any or type_ is object:
if is_none_type(type_) or type_ is Any or type_ is object:
if self.required is Undefined:
self.required = False
self.allow_none = True
if type_ is NoneType:
if is_none_type(type_):
continue
types_.append(type_)

Expand Down

0 comments on commit 0297d99

Please sign in to comment.