Skip to content

Commit 9e40be6

Browse files
authored
Replace optional in annotations (#18382)
1 parent 556ae16 commit 9e40be6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mypyc/irbuild/match.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from __future__ import annotations
2+
13
from collections.abc import Generator
24
from contextlib import contextmanager
3-
from typing import Optional
45

56
from mypy.nodes import MatchStmt, NameExpr, TypeInfo
67
from mypy.patterns import (
@@ -57,7 +58,7 @@ class MatchVisitor(TraverserVisitor):
5758
subject: Value
5859
match: MatchStmt
5960

60-
as_pattern: Optional[AsPattern] = None
61+
as_pattern: AsPattern | None = None
6162

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

341342
def prep_sequence_pattern(
342343
seq_pattern: SequencePattern,
343-
) -> tuple[Optional[int], Optional[NameExpr], list[Pattern]]:
344-
star_index: Optional[int] = None
345-
capture: Optional[NameExpr] = None
344+
) -> tuple[int | None, NameExpr | None, list[Pattern]]:
345+
star_index: int | None = None
346+
capture: NameExpr | None = None
346347
patterns: list[Pattern] = []
347348

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

0 commit comments

Comments
 (0)