1
1
import re
2
2
from abc import ABCMeta
3
- from typing import Iterator , Mapping , Optional , Pattern
3
+ from typing import Iterator , Mapping , Optional , Pattern , List
4
4
5
5
6
6
class Atom ():
@@ -36,7 +36,7 @@ def resolve(self, env: Mapping[str, Optional[str]]) -> str:
36
36
37
37
38
38
class Variable (Atom ):
39
- def __init__ (self , name : str , default : Optional [Iterator [Atom ]]) -> None :
39
+ def __init__ (self , name : str , default : Optional [List [Atom ]]) -> None :
40
40
self .name = name
41
41
self .default = default
42
42
@@ -52,7 +52,6 @@ def __hash__(self) -> int:
52
52
return hash ((self .__class__ , self .name , self .default ))
53
53
54
54
def resolve (self , env : Mapping [str , Optional [str ]]) -> str :
55
- # default = self.default if self.default is not None else ""
56
55
default = "" .join (atom .resolve (env ) for atom in self .default ) if self .default is not None else ""
57
56
result = env .get (self .name , default )
58
57
return result if result is not None else ""
@@ -76,7 +75,7 @@ def resolve(self, env: Mapping[str, Optional[str]]) -> str:
76
75
def parse_variables (value : str ) -> Iterator [Atom ]:
77
76
cursor = 0
78
77
79
- starts = []
78
+ starts : List [ int ] = []
80
79
esc = False
81
80
for i in range (len (value )):
82
81
if esc :
0 commit comments