Coverage for src/fjc_biographies/options.py: 100%
14 statements
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-22 22:47 +0000
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-22 22:47 +0000
1"""Default settings for downloading and parsing the FJC's judge biographies.
3These are module-level constants so that a project built on `fjc_biographies`
4can change them before they are used (for example,
5`fjc_biographies.options._TIMEOUT = 600` to wait longer for the FJC website).
7Contents:
8 _ABA_RATINGS: the number for each rating of the American Bar Association.
9 _APPEALS_CIRCUITS: the number of each court of appeals' circuit, by the
10 words that name it.
11 _CATEGORIES: the FJC's files of the directory, by what `fjc_biographies`
12 calls each.
13 _COLUMN_NAMES: names for the columns whose names are not made the usual
14 way (see `parser.tidy`).
15 _DATA_FOLDER: the data folder when fjc_biographies runs from its
16 repository.
17 _DISTRICT_CIRCUITS: the number of the circuit of each state or territory
18 with a district court.
19 _ENV_DATA: environment variable that can name the data folder.
20 _EXPORT_URL: address of the page that links to the FJC's files.
21 _FJC_URL: address of the folder with the FJC's files.
22 _PARTIES: the number for each party of an appointing president.
23 _TIMEOUT: seconds to wait for the FJC website before giving up.
24 _USER_AGENT: how fjc_biographies identifies itself to servers.
26"""
28from __future__ import annotations
30import pathlib
32_ABA_RATINGS: dict[str, int] = {
33 'Exceptionally Well Qualified': 4,
34 'Well Qualified': 3,
35 'Qualified': 2,
36 'Not Qualified': 1,
37 'Not Qualified By Reason of Age': 1}
38_APPEALS_CIRCUITS: dict[str, int] = {
39 'First': 1, 'Second': 2, 'Third': 3, 'Fourth': 4, 'Fifth': 5, 'Sixth': 6,
40 'Seventh': 7, 'Eighth': 8, 'Ninth': 9, 'Tenth': 10, 'Eleventh': 11,
41 'District of Columbia': 12, 'Federal': 13}
42# The files of the Biographical Directory of Article III Federal Judges that
43# are organized by category, in the order of the FJC's export page.
44_CATEGORIES: dict[str, str] = {
45 'demographics': 'demographics.csv',
46 'service': 'federal-judicial-service.csv',
47 'other_service': 'other-federal-judicial-service.csv',
48 'education': 'education.csv',
49 'career': 'professional-career.csv',
50 'other_nominations': 'other-nominations-recess.csv'}
51_COLUMN_NAMES: dict[str, str] = {
52 'ayes/nays': 'ayes_nays',
53 '2nd service as chief judge, begin': 'second_chief_judge_begin',
54 '2nd service as chief judge, end': 'second_chief_judge_end',
55 'service as chief judge, begin': 'chief_judge_begin',
56 'service as chief judge, end': 'chief_judge_end',
57 'other federal judicial service': 'description',
58 'other nominations/recess appointments': 'description',
59 'professional career': 'position',
60 'termination': 'termination_reason'}
61# "data/courts/fjc_biographies" two folders above the repository (beside the
62# folder of code projects), where courtpy and fjc-idb keep their data too.
63_DATA_FOLDER: pathlib.Path = (
64 pathlib.Path(__file__).parents[4] / 'data' / 'courts' / 'fjc_biographies')
65# The circuits that the states and territories are in now (12 for the
66# District of Columbia).
67_DISTRICT_CIRCUITS: dict[str, int] = {
68 'Maine': 1, 'Massachusetts': 1, 'New Hampshire': 1, 'Puerto Rico': 1,
69 'Rhode Island': 1,
70 'Connecticut': 2, 'New York': 2, 'Vermont': 2,
71 'Delaware': 3, 'New Jersey': 3, 'Pennsylvania': 3, 'Virgin Islands': 3,
72 'Maryland': 4, 'North Carolina': 4, 'South Carolina': 4, 'Virginia': 4,
73 'West Virginia': 4,
74 'Canal Zone': 5, 'Louisiana': 5, 'Mississippi': 5, 'Texas': 5,
75 'Kentucky': 6, 'Michigan': 6, 'Ohio': 6, 'Tennessee': 6,
76 'Illinois': 7, 'Indiana': 7, 'Wisconsin': 7,
77 'Arkansas': 8, 'Iowa': 8, 'Minnesota': 8, 'Missouri': 8, 'Nebraska': 8,
78 'North Dakota': 8, 'South Dakota': 8,
79 'Alaska': 9, 'Arizona': 9, 'California': 9, 'Guam': 9, 'Hawaii': 9,
80 'Idaho': 9, 'Montana': 9, 'Nevada': 9, 'Northern Mariana Islands': 9,
81 'Oregon': 9, 'Washington': 9,
82 'Colorado': 10, 'Kansas': 10, 'New Mexico': 10, 'Oklahoma': 10,
83 'Utah': 10, 'Wyoming': 10,
84 'Alabama': 11, 'Florida': 11, 'Georgia': 11,
85 'Columbia': 12}
86_ENV_DATA: str = 'FJC_BIOGRAPHIES_DATA_DIR'
87_EXPORT_URL: str = (
88 'https://www.fjc.gov/history/judges/'
89 'biographical-directory-article-iii-federal-judges-export')
90_FJC_URL: str = 'https://www.fjc.gov/sites/default/files/history/'
91_PARTIES: dict[str, int] = {'Democratic': -1, 'Republican': 1}
92_TIMEOUT: int = 300
93_USER_AGENT: str = (
94 'fjc_biographies (+https://github.com/WithPrecedent/fjc_biographies)')