-
Notifications
You must be signed in to change notification settings - Fork 44
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
Streamline API call flow (#142) #143
Conversation
cenpy/product.py
Outdated
|
||
@lazy_property | ||
def _legislative_year(self): | ||
return 'NotImpementedError' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be raise NotImplementedError()
rather than return the string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in this case. _legislative_year
is technically called on every layer lookup, but only formats if {legislative_year}
is present in the string. If it raises an Exception, every query will fail.
layername_s = self._layer_lookup[for_geography].format(
census_year=self._census_year,
legislative_year=self._legislative_year,
congressional_district=self._congressional_district,
)
Not sure if this was the best method, but it was the quickest. An alternative would to search for the placeholder and replace if present. Then we can easily raise exceptions.
I think this pull request might be ready for an initial review and potentially a There are still a handful of items that need to be bolted on in the near future:
Working Geographies
Whole GeographiesAlmost all whole geographies are currently working. There are also three specific whole geographies cases that didn't work:
These three are similar to
|
Closes #142