Skip to content

Commit

Permalink
fix: typing error in variables.py and its test
Browse files Browse the repository at this point in the history
  • Loading branch information
iamfat committed Sep 3, 2022
1 parent 7d2c82a commit d3478e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/dotenv/variables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
from abc import ABCMeta
from typing import Iterator, Mapping, Optional, Pattern
from typing import Iterator, Mapping, Optional, Pattern, List


class Atom():
Expand Down Expand Up @@ -36,7 +36,7 @@ def resolve(self, env: Mapping[str, Optional[str]]) -> str:


class Variable(Atom):
def __init__(self, name: str, default: Optional[Iterator[Atom]]) -> None:
def __init__(self, name: str, default: Optional[List[Atom]]) -> None:
self.name = name
self.default = default

Expand All @@ -52,7 +52,6 @@ def __hash__(self) -> int:
return hash((self.__class__, self.name, self.default))

def resolve(self, env: Mapping[str, Optional[str]]) -> str:
# default = self.default if self.default is not None else ""
default = "".join(atom.resolve(env) for atom in self.default) if self.default is not None else ""
result = env.get(self.name, default)
return result if result is not None else ""
Expand All @@ -76,7 +75,7 @@ def resolve(self, env: Mapping[str, Optional[str]]) -> str:
def parse_variables(value: str) -> Iterator[Atom]:
cursor = 0

starts = []
starts: List[int] = []
esc = False
for i in range(len(value)):
if esc:
Expand Down

0 comments on commit d3478e8

Please sign in to comment.