Skip to content

Commit

Permalink
Replace optional in annotations (#18382)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Dec 30, 2024
1 parent 556ae16 commit 9e40be6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mypyc/irbuild/match.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from collections.abc import Generator
from contextlib import contextmanager
from typing import Optional

from mypy.nodes import MatchStmt, NameExpr, TypeInfo
from mypy.patterns import (
Expand Down Expand Up @@ -57,7 +58,7 @@ class MatchVisitor(TraverserVisitor):
subject: Value
match: MatchStmt

as_pattern: Optional[AsPattern] = None
as_pattern: AsPattern | None = None

def __init__(self, builder: IRBuilder, match_node: MatchStmt) -> None:
self.builder = builder
Expand Down Expand Up @@ -340,9 +341,9 @@ def enter_subpattern(self, subject: Value) -> Generator[None, None, None]:

def prep_sequence_pattern(
seq_pattern: SequencePattern,
) -> tuple[Optional[int], Optional[NameExpr], list[Pattern]]:
star_index: Optional[int] = None
capture: Optional[NameExpr] = None
) -> tuple[int | None, NameExpr | None, list[Pattern]]:
star_index: int | None = None
capture: NameExpr | None = None
patterns: list[Pattern] = []

for i, pattern in enumerate(seq_pattern.patterns):
Expand Down

0 comments on commit 9e40be6

Please sign in to comment.