Skip to content

Commit

Permalink
make it a lil chiller case-wise
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgosnell authored and e-belfer committed Feb 17, 2025
1 parent f2e7546 commit c0f0df6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pudl_archiver/archivers/eia/eiamecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
BASE_URL = "https://www.eia.gov/consumption/manufacturing/data"

TABLE_LINK_PATTERNS: dict[str | int, str] = {
"recent": r"(RSE|)[Tt]able(\d{1,2}|\d{1.1})_(\d{1,2})(.xlsx|.xls)",
2002: r"(RSE|)[Tt]able(\d{1,2}).(\d{1,2})_\d{1,2}(.xlsx|.xls)",
"recent": r"(rse|)table(\d{1,2}|\d{1.1})_(\d{1,2})(.xlsx|.xls)",
2002: r"(rse|)table(\d{1,2}).(\d{1,2})_\d{1,2}(.xlsx|.xls)",
# These earlier years the pattern is functional but not actually very informative.
# so we will just use the original name by making the whole pattern a match
1998: r"((d|e)\d{2}([a-z]\d{1,2})_(\d{1,2})(.xlsx|.xls))",
Expand Down Expand Up @@ -68,7 +68,9 @@ async def get_year_resources(self, year: int) -> list[ResourceInfo]:
[year for year in TABLE_LINK_PATTERNS if isinstance(year, int)]
)
if int(year) > max_old_year:
table_link_pattern = re.compile(TABLE_LINK_PATTERNS["recent"])
table_link_pattern = re.compile(
TABLE_LINK_PATTERNS["recent"], re.IGNORECASE
)
else:
table_link_pattern = re.compile(
TABLE_LINK_PATTERNS[int(year)], re.IGNORECASE
Expand Down

0 comments on commit c0f0df6

Please sign in to comment.