Fix utils.parse.hashflags type hints
This commit is contained in:
parent
268c5adb3c
commit
eeee2458d3
2 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue