Skip to content

Commit f7088c2

Browse files
committed
chore: Better usage for typing.Literal
1 parent b48a9c9 commit f7088c2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/sphinxnotes/data/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ast import literal_eval
66

77
if TYPE_CHECKING:
8-
from typing import Any, Callable, Generator, Self, Literal as Lit
8+
from typing import Any, Callable, Generator, Self, Literal
99

1010

1111
#########################################
@@ -67,7 +67,7 @@ class BoolFlag(Flag):
6767
default: bool = False
6868

6969

70-
type FlagStore = Lit['assign'] | Lit['append']
70+
type FlagStore = Literal['assign', 'append']
7171

7272

7373
@dataclass(frozen=True)

src/sphinxnotes/data/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TypeVar, cast, Literal as Lit
1+
from typing import TypeVar, cast, Literal
22

33
from docutils import nodes
44
from docutils.frontend import get_default_settings
@@ -81,7 +81,7 @@ class Reporter(nodes.system_message):
8181
def __init__(
8282
self,
8383
title: str,
84-
level: Lit['DEBUG'] | Lit['INFO'] | Lit['WARNING'] | Lit['ERROR'] = 'DEBUG',
84+
level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'DEBUG',
8585
) -> None:
8686
super().__init__(title + ':', type=level, level=2, source='')
8787
# logger.warning(f'creating a new report: {title}')

0 commit comments

Comments
 (0)