Skip to content

Commit b0db9c8

Browse files
author
Lukas Schrangl
committed
Add hack for Python < 3.8 missing typing.Literal
1 parent faee58a commit b0db9c8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

smfret_analysis/tracker.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
import re
66
import collections
77
from pathlib import Path
8-
from typing import (Any, Dict, Iterable, Literal, Optional, Sequence, Tuple,
9-
Union)
8+
from typing import (Any, Dict, Iterable, Optional, Sequence, Tuple, Union)
9+
try:
10+
from typing import Literal
11+
except ImportError:
12+
# Hack for Python < 3.8
13+
# Is there a better solution?
14+
class Literal:
15+
def __class_getitem__(cls, item):
16+
return str(list(item))
1017
import warnings
1118

1219
from IPython.display import display

0 commit comments

Comments
 (0)