@@ -62,15 +62,15 @@ def _make_optional(t: mypy.types.Type) -> mypy.types.UnionType:
6262
6363def _unwrap_optional (t : mypy .types .Type ) -> mypy .types .Type :
6464 """Unwraps a potentially optional type"""
65- if not isinstance (t , mypy .types .UnionType ):
65+ if not isinstance (t , mypy .types .UnionType ): # pragma: no cover
6666 return t
6767 t = mypy .types .UnionType ([item for item in t .items if not isinstance (item , mypy .types .NoneType )])
68- if len (t .items ) == 0 :
68+ if len (t .items ) == 0 : # pragma: no cover
6969 return mypy .types .NoneType ()
7070 elif len (t .items ) == 1 :
7171 return t .items [0 ]
7272 else :
73- return t
73+ return t # pragma: no cover
7474
7575
7676def _get_method_sig_hook (ctx : mypy .plugin .MethodSigContext ) -> mypy .types .CallableType :
@@ -82,7 +82,7 @@ def _get_method_sig_hook(ctx: mypy.plugin.MethodSigContext) -> mypy.types.Callab
8282 return sig
8383 try :
8484 (instance_type , owner_type ) = sig .arg_types
85- except ValueError :
85+ except ValueError : # pragma: no cover
8686 return sig
8787 if isinstance (instance_type , mypy .types .NoneType ): # class attribute access
8888 return sig
@@ -98,9 +98,7 @@ def _set_method_sig_hook(ctx: mypy.plugin.MethodSigContext) -> mypy.types.Callab
9898 return sig
9999 try :
100100 (instance_type , value_type ) = sig .arg_types
101- except ValueError :
102- return sig
103- if not isinstance (instance_type , mypy .types .AnyType ): # instance attribute access
101+ except ValueError : # pragma: no cover
104102 return sig
105103 return sig .copy_modified (arg_types = [instance_type , _unwrap_optional (value_type )])
106104
0 commit comments