Skip to content

Commit 01532f6

Browse files
committed
Replace | None with Optional.
1 parent 3e14254 commit 01532f6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

python/selfie-lib/selfie_lib/LineReader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
from typing import Optional
23

34

45
def _to_unix(s: str) -> str:
@@ -30,7 +31,7 @@ def __detect_newline_type(self) -> bool:
3031
def unix_newlines(self) -> bool:
3132
return self.__uses_unix_newlines
3233

33-
def read_line(self) -> str | None:
34+
def read_line(self) -> Optional[str]:
3435
line_bytes = self.__buffer.readline()
3536
if line_bytes == b"":
3637
return None

python/selfie-lib/selfie_lib/Literals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
from abc import abstractmethod
44
from enum import Enum, auto
5-
from typing import Any, Protocol, TypeVar
5+
from typing import Any, Optional, Protocol, TypeVar
66

77
from .EscapeLeadingWhitespace import EscapeLeadingWhitespace
88

@@ -22,7 +22,7 @@ def from_filename(cls, filename: str) -> "Language":
2222

2323

2424
class LiteralValue:
25-
def __init__(self, expected: T | None, actual: T, fmt: "LiteralFormat") -> None:
25+
def __init__(self, expected: Optional[T], actual: T, fmt: "LiteralFormat") -> None:
2626
self.expected = expected
2727
self.actual = actual
2828
self.format = fmt

python/selfie-lib/selfie_lib/SnapshotValueReader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class SnapshotValueReader:
1717

1818
def __init__(self, line_reader: LineReader):
1919
self.line_reader = line_reader
20-
self.line: str | None = None
20+
self.line: Optional[str] = None
2121
self.unix_newlines = self.line_reader.unix_newlines()
2222

23-
def peek_key(self) -> str | None:
23+
def peek_key(self) -> Optional[str]:
2424
return self.__next_key()
2525

2626
def next_value(self) -> SnapshotValue:

0 commit comments

Comments
 (0)