Don't store hashflags as a dict before returning them - allow duplicate keys

This commit is contained in:
jesopo 2019-05-25 12:58:07 +01:00
parent 30b7c2419d
commit d0634bb54e

View file

@ -2,7 +2,7 @@ import io, typing
COMMENT_TYPES = ["#", "//"] COMMENT_TYPES = ["#", "//"]
def hashflags(filename: str) -> typing.List[typing.Tuple[str, str]]: def hashflags(filename: str) -> typing.List[typing.Tuple[str, str]]:
hashflags = {} hashflags = []
with io.open(filename, mode="r", encoding="utf8") as f: with io.open(filename, mode="r", encoding="utf8") as f:
for line in f: for line in f:
line = line.strip("\n") line = line.strip("\n")
@ -17,8 +17,8 @@ def hashflags(filename: str) -> typing.List[typing.Tuple[str, str]]:
break break
elif line.startswith("--"): elif line.startswith("--"):
hashflag, sep, value = line[2:].partition(" ") hashflag, sep, value = line[2:].partition(" ")
hashflags[hashflag] = value if sep else None hashflags.append([hashflag, value if sep else None])
return list(hashflags.items()) return hashflags
class Docstring(object): class Docstring(object):
def __init__(self, description: str, items: typing.Dict[str, str], def __init__(self, description: str, items: typing.Dict[str, str],