Skip to content

Commit 24d6ea5

Browse files
committed
Fix wrong docstring, use code fences consistently
1 parent cff62cb commit 24d6ea5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

mypy/constraints.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,10 @@ def _infer_constraints(
428428

429429

430430
def _is_type_type(tp: ProperType) -> TypeGuard[TypeType | UnionType]:
431-
"""Is ``tp`` a type[...] or union thereof?
431+
"""Is ``tp`` a ``type[...]`` or a union thereof?
432432
433-
Type[A | B] is internally represented as type[A] | type[B], and this troubles
434-
the solver sometimes.
433+
``Type[A | B]`` is internally represented as ``type[A] | type[B]``, and this
434+
troubles the solver sometimes.
435435
"""
436436
return (
437437
isinstance(tp, TypeType)
@@ -441,11 +441,7 @@ def _is_type_type(tp: ProperType) -> TypeGuard[TypeType | UnionType]:
441441

442442

443443
def _unwrap_type_type(tp: TypeType | UnionType) -> ProperType:
444-
"""Rewrite `type[A] | type[B]` as `type[A | B]`.
445-
446-
This is an opposite of normalized form used elsewhere, necessary to solve type[...]
447-
constraints on typevars.
448-
"""
444+
"""Extract the inner type from ``type[...]`` expression or a union thereof."""
449445
if isinstance(tp, TypeType):
450446
return tp.item
451447
return UnionType.make_union([cast(TypeType, get_proper_type(o)).item for o in tp.items])

0 commit comments

Comments
 (0)