diff options
| author | 2019-05-25 21:42:42 +0100 | |
|---|---|---|
| committer | 2019-05-25 21:42:42 +0100 | |
| commit | eeee2458d3bd05e07cade53454383de184f8fde7 (patch) | |
| tree | 999fc237c36e64ca168fade6598980c95eaf8a79 /src | |
| parent | Add `depends-on` hashflags to relevant modules (diff) | |
| signature | ||
Fix utils.parse.hashflags type hints
Diffstat (limited to 'src')
| -rw-r--r-- | src/ModuleManager.py | 2 | ||||
| -rw-r--r-- | src/utils/parse.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 6aafa9b3..ca636063 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -53,7 +53,7 @@ class ModuleDefinition(object): name: str, filename: str, type: ModuleType, - hashflags: typing.List[typing.Tuple[str, str]]): + hashflags: typing.List[typing.Tuple[str, typing.Optional[str]]]): self.name = name self.filename = filename self.type = type diff --git a/src/utils/parse.py b/src/utils/parse.py index ca7e6ed4..0c3838a1 100644 --- a/src/utils/parse.py +++ b/src/utils/parse.py @@ -1,8 +1,9 @@ import io, typing COMMENT_TYPES = ["#", "//"] -def hashflags(filename: str) -> typing.List[typing.Tuple[str, str]]: - hashflags = [] +def hashflags(filename: str + ) -> typing.List[typing.Tuple[str, typing.Optional[str]]]: + hashflags = [] # type: typing.List[typing.Tuple[str, typing.Optional[str]]] with io.open(filename, mode="r", encoding="utf8") as f: for line in f: line = line.strip("\n") @@ -17,7 +18,7 @@ def hashflags(filename: str) -> typing.List[typing.Tuple[str, str]]: break elif line.startswith("--"): hashflag, sep, value = line[2:].partition(" ") - hashflags.append([hashflag, value if sep else None]) + hashflags.append((hashflag, (value if sep else None))) return hashflags class Docstring(object): |
