Diagnostic

class Diagnostic(level: DiagnosticLevel, stage: DiagnosticStage, symbol: str, message: str)[source]

Bases: object

An immutable record of a single issue detected during stub generation.

Parameters:
  • level (DiagnosticLevel) – Severity.

  • stage (DiagnosticStage) – Pipeline stage that raised this diagnostic.

  • symbol (str) – Human-readable name of the symbol being processed when the issue was detected (e.g. "MyClass.__init__" or "module-level").

  • message (str) – Human-readable description of the issue.

Examples

>>> from stubpy.diagnostics import Diagnostic, DiagnosticLevel, DiagnosticStage
>>> d = Diagnostic(DiagnosticLevel.WARNING, DiagnosticStage.RESOLVE,
...                "Child.__init__", "Could not resolve kwargs")
>>> str(d)
'[WARNING] (resolve) Child.__init__: Could not resolve kwargs'
level: DiagnosticLevel
stage: DiagnosticStage
symbol: str
message: str
__init__(level: DiagnosticLevel, stage: DiagnosticStage, symbol: str, message: str) None

See also

Public API reference — overview of all public names.