Skip to content

Commit 3a4087a

Browse files
authored
Merge pull request #92 from z3c0/test (v0.9.49)
v0.9.49
2 parents 6bb9f3d + f2d90a7 commit 3a4087a

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ name: integration-tests
22

33
on:
44
pull_request:
5-
branches:
6-
- master
5+
paths:
6+
- "vistos/*"
7+
- setup.py
8+
- requirements.txt
9+
branches:
10+
- master
711

812
jobs:
913
run-integration-tests:

vistos/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.48
1+
0.9.49

vistos/src/gpo/govinfo.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,36 @@ def _get_cdir_for_member(api_key: str, bioguide_member: BioguideMemberRecord) \
9191
-> Optional[GovInfoMemberRecord]:
9292
"""Returns the biography data for the given BioguideMemberRecord"""
9393

94-
current_congress = util.get_current_congress_number()
95-
9694
# if a member dies in office, they will not be in the CDIR
9795
# for that term
96+
terms = bioguide_member.terms
9897
if bioguide_member.death_year is not None:
99-
terms = [term for term in bioguide_member.terms
100-
if term.end_year < int(bioguide_member.death_year)]
101-
else:
102-
terms = bioguide_member.terms
98+
try:
99+
terms = [term for term in bioguide_member.terms
100+
if term.end_year < int(bioguide_member.death_year)]
101+
except ValueError:
102+
# Death year may not be an int (1885c or Unknown).
103+
# If it's not an int, than it's unknown
104+
# and can't be relied on.
105+
# If their death year is far enough back
106+
# to be unknown, then they likely do not
107+
# have govinfo data, so no harm done
108+
pass
103109

104110
if len(terms) == 0:
111+
# if all terms were excluded by the prior step, then
105112
# they died in their first term and they wouldn't
106-
# have govinfo anyways
113+
# have govinfo anyways, so exit returning None
107114
return None
108115

116+
current_congress = util.get_current_congress_number()
117+
# govinfo doesn't have the CDIR of the current congress, so exclude it
109118
last_term = max(terms, key=lambda t: int(t.congress_number)
110119
if t.congress_number != current_congress else -1)
111120

112121
if not _cdir_exists(api_key, last_term.congress_number):
122+
# if the last term doesn't have data, then none of the preceding
123+
# terms can be expected to have data either, so exit returning None
113124
return None
114125

115126
packages = \

0 commit comments

Comments
 (0)