MCPcopy Index your code
hub / github.com/python/mypy / report_non_method_protocol

Method report_non_method_protocol

mypy/messages.py:2118–2127  ·  view source on GitHub ↗
(
        self, tp: TypeInfo, members: list[str], context: Context
    )

Source from the content-addressed store, hash-verified

2116 self.fail(f"Cannot use {method_name}() with {type_name} type", context)
2117
2118 def report_non_method_protocol(
2119 self, tp: TypeInfo, members: list[str], context: Context
2120 ) -> None:
2121 self.fail(
2122 "Only protocols that don't have non-method members can be used with issubclass()",
2123 context,
2124 )
2125 if len(members) < 3:
2126 attrs = ", ".join(members)
2127 self.note(f'Protocol "{tp.name}" has non-method member(s): {attrs}', context)
2128
2129 def note_call(
2130 self, subtype: Type, call: Type, context: Context, *, code: ErrorCode | None

Callers 1

Calls 4

failMethod · 0.95
noteMethod · 0.95
lenFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected