Fix some typing bits
This commit is contained in:
parent
ffc3934487
commit
db6d5ad880
@ -3,7 +3,13 @@ import typing
|
||||
|
||||
|
||||
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)}")
|
||||
return 0
|
||||
|
||||
@ -88,8 +94,8 @@ class Passport:
|
||||
|
||||
|
||||
def _read_passports(
|
||||
instream: typing.BinaryIO,
|
||||
) -> typing.Generator[None, None, Passport]:
|
||||
instream: typing.TextIO,
|
||||
) -> typing.Generator[typing.Optional[Passport], None, None]:
|
||||
cur = Passport()
|
||||
|
||||
for i, line in enumerate(instream):
|
||||
|
Loading…
Reference in New Issue
Block a user