Skip to content

[dsew-cpr] Fix UnboundLocalError #1583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dsew_community_profile/delphi_dsew_community_profile/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def fetch_listing(params):
)
for el in listing if el['filename'].endswith("xlsx")
]
keep = []
if params['indicator']['reports'] == 'new':
# drop files we already have in the input cache
keep = [el for el in listing if not os.path.exists(el['cached_filename'])]
Expand All @@ -439,7 +440,11 @@ def fetch_listing(params):
if params['indicator']['export_start_date'] <= el['publish_date']
]
# can't do the same for export_end_date
return extend_listing_for_interp(keep, listing)

# if we're only running on a subset, make sure we have enough data for interp
if keep:
keep = extend_listing_for_interp(keep, listing)
return keep if keep else listing

def extend_listing_for_interp(keep, listing):
"""Grab additional files from the full listing for interpolation if needed.
Expand Down