Skip to content

Commit

Permalink
zipfile type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bdilday committed Feb 12, 2023
1 parent 15c5d08 commit 55712a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pybaseball/playerid_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def get_register_file():
return os.path.join(cache.config.cache_directory, 'chadwick-register.csv')


def _extract_people_files(zip_archive: bytes) -> Iterable[zipfile.ZipInfo]:
def _extract_people_files(zip_archive: zipfile.ZipFile) -> Iterable[zipfile.ZipInfo]:
return filter(
lambda zip_info: re.search(PEOPLE_FILE_PATTERN, zip_info.filename),
zip_archive.infolist(),
)


def _extract_people_table(zip_archive: bytes) -> pd.DataFrame:
def _extract_people_table(zip_archive: zipfile.ZipFile) -> pd.DataFrame:
dfs = map(
lambda zip_info: pd.read_csv(io.BytesIO(zip_archive.read(zip_info.filename))),
_extract_people_files(zip_archive),
Expand Down

0 comments on commit 55712a5

Please sign in to comment.