Skip to content

Commit

Permalink
ErrorCode is no longer an enum (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Mar 2, 2024
1 parent db5b7ef commit bfbc445
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 269 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Make error registry into a custom class instead of an enum, removing
dependency on `aenum` (#739)
- Treat subclasses of `int` as subclasses of `float` and `complex` too (#738)
- Fix crash on encountering certain decorators in stubs (#734)
- Fix inference of signature for certain secondary methods (#732)
Expand Down
8 changes: 4 additions & 4 deletions pyanalyze/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from pyanalyze.annotated_types import get_annotated_types_extension

from . import type_evaluation
from .error_code import ErrorCode
from .error_code import Error, ErrorCode
from .extensions import (
AsynqCallable,
CustomCheck,
Expand Down Expand Up @@ -168,7 +168,7 @@ def add_evaluation(self, obj: object) -> Generator[None, None, None]:
def show_error(
self,
message: str,
error_code: ErrorCode = ErrorCode.invalid_annotation,
error_code: Error = ErrorCode.invalid_annotation,
node: Optional[ast.AST] = None,
) -> None:
"""Show an error found while evaluating an annotation."""
Expand Down Expand Up @@ -239,7 +239,7 @@ class SyntheticEvaluator(type_evaluation.Evaluator):
def show_error(
self,
message: str,
error_code: ErrorCode = ErrorCode.invalid_annotation,
error_code: Error = ErrorCode.invalid_annotation,
node: Optional[ast.AST] = None,
) -> None:
self.error_ctx.show_error(node or self.node, message, error_code=error_code)
Expand Down Expand Up @@ -904,7 +904,7 @@ def __init__(
def show_error(
self,
message: str,
error_code: ErrorCode = ErrorCode.invalid_annotation,
error_code: Error = ErrorCode.invalid_annotation,
node: Optional[ast.AST] = None,
) -> None:
if node is None:
Expand Down
Loading

0 comments on commit bfbc445

Please sign in to comment.