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

Method fail

mypy/semanal.py:7661–7686  ·  view source on GitHub ↗
(
        self,
        msg: str | ErrorMessage,
        ctx: Context,
        serious: bool = False,
        *,
        code: ErrorCode | None = None,
        blocker: bool = False,
    )

Source from the content-addressed store, hash-verified

7659 return True
7660
7661 def fail(
7662 self,
7663 msg: str | ErrorMessage,
7664 ctx: Context,
7665 serious: bool = False,
7666 *,
7667 code: ErrorCode | None = None,
7668 blocker: bool = False,
7669 ) -> None:
7670 if not serious and not self.in_checked_function():
7671 return
7672 # In case it's a bug and we don't really have context
7673 assert ctx is not None, msg
7674 if isinstance(msg, ErrorMessage):
7675 if code is None:
7676 code = msg.code
7677 msg = msg.value
7678 self.errors.report(
7679 ctx.line,
7680 ctx.column,
7681 msg,
7682 blocker=blocker,
7683 code=code,
7684 end_line=ctx.end_line,
7685 end_column=ctx.end_column,
7686 )
7687
7688 def note(self, msg: str, ctx: Context, code: ErrorCode | None = None) -> None:
7689 if not self.in_checked_function():

Calls 3

in_checked_functionMethod · 0.95
isinstanceFunction · 0.85
reportMethod · 0.45

Tested by

no test coverage detected