Fix some typing bits
This commit is contained in:
parent
ffc3934487
commit
db6d5ad880
@ -3,7 +3,13 @@ import typing
|
|||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
checked = [passport.is_valid() for passport in _read_passports(sys.stdin)]
|
checked = []
|
||||||
|
for passport in _read_passports(sys.stdin):
|
||||||
|
if passport is None:
|
||||||
|
checked.append(False)
|
||||||
|
continue
|
||||||
|
checked.append(passport.is_valid())
|
||||||
|
|
||||||
print(f"total={len(checked)} valid={checked.count(True)}")
|
print(f"total={len(checked)} valid={checked.count(True)}")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@ -88,8 +94,8 @@ class Passport:
|
|||||||
|
|
||||||
|
|
||||||
def _read_passports(
|
def _read_passports(
|
||||||
instream: typing.BinaryIO,
|
instream: typing.TextIO,
|
||||||
) -> typing.Generator[None, None, Passport]:
|
) -> typing.Generator[typing.Optional[Passport], None, None]:
|
||||||
cur = Passport()
|
cur = Passport()
|
||||||
|
|
||||||
for i, line in enumerate(instream):
|
for i, line in enumerate(instream):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user