elex.cli.app¶
elex.cli.app.
ElexBaseController
(*args, **kw)Upon completion you unlock the 'Devil Horns', a very special weapon, similar to the foam finger from Dead Space 2. Retro Mode: Complete Hardcore mode to unlock the Retro Mode. Classic Mode: The Classic Mode is a rewind to the original Dead Space. Single-player only, with no cross-hairs or any resource management elements. Collectable Rewards. Strategy Guide/Walkthrough/FAQ Cheat mode. Insert an Xbox 360 controller. Pause the game, and enter one of the following codes. If you entered the code.
- class
Meta
label
= 'base'
description
= 'Get and process AP elections data'
arguments
= [(['date'], {'nargs': '*', 'help': 'Election date (e.g. '2015-11-03'; most common date formats accepted).', 'action': 'store'}), (['-t', '--test'], {'help': 'Use testing API calls', 'action': 'store_true'}), (['-n', '--not-live'], {'help': 'Do not use live data API calls', 'action': 'store_true'}), (['-d', '--data-file'], {'help': 'Specify data file instead of making HTTP request when using election commands like `elex results` and `elex races`.', 'action': 'store'}), (['--delegate-sum-file'], {'help': 'Specify delegate sum report file instead of making HTTP request when using `elex delegates`', 'action': 'store'}), (['--delegate-super-file'], {'help': 'Specify delegate super report file instead of making HTTP request when using `elex delegates`', 'action': 'store'}), (['--trend-file'], {'help': 'Specify trend file instead of making HTTP request when when using `elex [gov/house/senate]-trends`', 'action': 'store'}), (['--format-json'], {'help': 'Pretty print JSON when using `-o json`.', 'action': 'store_true'}), (['-v', '--version'], {'version': 'nElex version 2.4.3n', 'action': 'version'}), (['--results-level'], {'help': 'Specify reporting level for results.', 'action': 'store', 'default': 'ru'}), (['--officeids'], {'help': 'Specify officeids to parse.', 'action': 'store', 'default': None}), (['--raceids'], {'help': 'Specify raceids to parse.', 'action': 'store', 'default': []}), (['--set-zero-counts'], {'help': 'Override results with zeros; omits the winner indicator.Sets the vote, delegate, and reporting precinct counts to zero.', 'action': 'store_true', 'default': False}), (['--national-only'], {'help': 'Limit results to national-level results only.', 'action': 'store_true', 'default': None}), (['--local-only'], {'help': 'Limit results to local-level results only.', 'action': 'store_true', 'default': None}), (['--with-timestamp'], {'help': 'Append a `timestamp` column to each row of data output with current system timestamp.', 'action': 'store_true'}), (['--batch-name'], {'help': 'Specify a value for a `batchname` column to append to each row.', 'action': 'store'})]
default
()
races
()elexraces<electiondate>
Returns race data for a given election date.
Command:
Example output:
id | raceid | racetype | racetypeid | description | electiondate | initialization_data | is_ballot_measure | lastupdated | national | officeid | officename | party | seatname | seatnum | statename | statepostal | test | uncontested |
2919 | 2919 | Caucus | E | 2016-03-26 | True | False | 2016-03-27T03:03:54Z | True | P | President | Dem | AK | False | False | ||||
12975 | 12975 | Caucus | E | 2016-03-26 | True | False | 2016-03-29T17:17:41Z | True | P | President | Dem | HI | False | False | ||||
… |
reporting_units
()elexreporting-units<electiondate>
Returns reporting unit data for a given election date.
Reporting units represent geographic aggregation of voting data at thenational, state, county, and district level.
Command:
candidate_reporting_units
()elexcandidate-reporting-units<electiondate>
Returns candidate reporting unit data for a given election date.
A candidate reporting unit is a container for the results of a votingin a specific reporting unit. This command is a close cousin ofelex results <electiondate>.
This command does not return results.
Command:
Notes:
This command can be used to quickly create schemas.
Will output:
candidates
()elexcandidates<electiondate>
Returns candidate data for a given election date.
Command:
Example output:
id | candidateid | ballotorder | first | last | party | polid | polnum |
polid-1445 | 6527 | 2 | Bernie | Sanders | Dem | 1445 | 4262 |
polid-1746 | 6526 | 1 | Hillary | Clinton | Dem | 1746 | 4261 |
… |
ballot_measures
()elexballot-measures<electiondate>
Returns ballot measure data for a given election date.
Command:
Example output:
id | candidateid | ballotorder | description | electiondate | last | polid | polnum | seatname |
2016-03-15-43697 | 43697 | 1 | 2016-03-15 | For | 37229 | Public Improvement Bonds | ||
2016-03-15-43698 | 43698 | 2 | 2016-03-15 | Against | 37230 | Public Improvement Bonds | ||
… |
results
()elexresults<electiondate>
Returns result data.
Each row in the output represents a fully flattened anddenormalized version of a result for specific candidate ina specific race.
Command:
Example output:
id | unique_id | raceid | racetype | racetypeid | ballotorder | candidateid | description | delegatecount | electiondate | fipscode | first | incumbent | initialization_data | is_ballot_measure | last | lastupdated | level | national | officeid | officename | party | polid | polnum | precinctsreporting | precinctsreportingpct | precinctstotal | reportingunitid | reportingunitname | runoff | seatname | seatnum | statename | statepostal | test | uncontested | votecount | votepct | winner |
3021-polid-61815-state-1 | 3021 | Caucus | S | 2 | 6528 | 0 | 2016-03-01 | Ted | False | False | False | Cruz | 2016-03-02T17:05:46Z | state | True | P | President | GOP | 61815 | 4263 | 72 | 1.0 | 72 | state-1 | False | Alaska | AK | False | False | 7973 | 0.363566 | True | ||||||
3021-polid-8639-state-1 | 3021 | Caucus | S | 5 | 6548 | 0 | 2016-03-01 | Donald | False | False | False | Trump | 2016-03-02T17:05:46Z | state | True | P | President | GOP | 8639 | 4273 | 72 | 1.0 | 72 | state-1 | False | Alaska | AK | False | False | 7346 | 0.334975 | False | ||||||
… |
elections
()elexelections
Returns all elections known to the API.
Command:
Example output:
2016-02-09 | 2016-02-09 | True | False |
2016-02-16 | 2016-02-16 | True | False |
… |
delegates
()elexdelegates
Returns delegate report data.
Command:
Example output:
level | party_total | superdelegates_count | last | state | candidateid | party_need | party | delegates_count | id | d1 | d7 | d30 |
state | 2472 | 0 | Bush | MN | 1239 | 1237 | GOP | 0 | MN-1239 | 0 | 0 | 0 |
state | 2472 | 0 | Bush | OR | 1239 | 1237 | GOP | 0 | OR-1239 | 0 | 0 | 0 |
governor_trends
()elexgovernor-trends
Governor balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | Governor | 7 | 7 | 12 | 19 | 20 | 0 | -1 | 0 |
house_trends
()elexhouse-trends
House balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | U.S. House | 201 | 201 | 0 | 201 | 193 | 0 | +8 | 0 |
senate_trends
()elexsenate-trends
Senate balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | U.S. Senate | 23 | 23 | 30 | 53 | 51 | 0 | +2 | 0 |
next_election
()elexnext-election<date-after>
Returns data about the next election with an optional dateto start searching.
Command:
Example output:
id | electiondate | liveresults | testresults |
2016-04-19 | 2016-04-19 | False | True |
You can also specify the date to find the next election after, e.g.:
This will find the first election after April 15, 2016.
clear_cache
()elexclear-cache
Returns data about the next election with an optional dateto start searching.
Command:
If no cache entries exist, elex will close with exit code 65.
elex.cli.app.
ElexApp
(label=None, **kw)Meta
label
= 'elex'
base_controller
alias of ElexBaseController
exit_on_close
= True
hooks
= [('post_setup', <function cachecontrol_logging_hook>), ('post_argument_parsing', <function add_election_hook>)]
extensions
= ['elex.cli.ext_csv', 'elex.cli.ext_json']
output_handler
= 'csv'
handler_override_options
= {'output': (['-o'], {'help': 'output format (default: csv)'})}
log_handler
= <cement.ext.ext_logging.LoggingLogHandler object>
elex.cli.app.
main
()
elex.cli.decorators¶
elex.cli.decorators.
require_date_argument
(fn)¶Decorator that checks for date argument.
elex.cli.decorators.
require_ap_api_key
(fn)¶Decorator that checks for Associated Press API key or¶
overridable
= True¶
render
(data, template=None)¶
Dead Space Cheats Pc Keyboard
elex.cli.ext_csv.
load
(app)¶
elex.cli.ext_json¶
elex.cli.ext_json.
ElexJSONOutputHandler
(*args, **kw)¶A custom JSON output handler
- class
Meta
¶ label
= 'json'¶
overridable
= True¶
render
(data, template=None)¶
elex.cli.ext_json.
load
(app)¶
elex.cli.hooks¶
elex.cli.hooks.
add_election_hook
(app)¶Cache election API object reference after parsing args.
elex.cli.hooks.
cachecontrol_logging_hook
(app)¶Reroute cachecontrol logger to use cement log handlers.
elex.cli.utils¶
elex.cli.utils.
parse_date
(datestring)¶Parse many date formats into an AP friendly format.
elex.cli.app¶
elex.cli.app.
ElexBaseController
(*args, **kw)- class
Meta
label
= 'base'
description
= 'Get and process AP elections data'
arguments
= [(['date'], {'nargs': '*', 'help': 'Election date (e.g. '2015-11-03'; most common date formats accepted).', 'action': 'store'}), (['-t', '--test'], {'help': 'Use testing API calls', 'action': 'store_true'}), (['-n', '--not-live'], {'help': 'Do not use live data API calls', 'action': 'store_true'}), (['-d', '--data-file'], {'help': 'Specify data file instead of making HTTP request when using election commands like `elex results` and `elex races`.', 'action': 'store'}), (['--delegate-sum-file'], {'help': 'Specify delegate sum report file instead of making HTTP request when using `elex delegates`', 'action': 'store'}), (['--delegate-super-file'], {'help': 'Specify delegate super report file instead of making HTTP request when using `elex delegates`', 'action': 'store'}), (['--trend-file'], {'help': 'Specify trend file instead of making HTTP request when when using `elex [gov/house/senate]-trends`', 'action': 'store'}), (['--format-json'], {'help': 'Pretty print JSON when using `-o json`.', 'action': 'store_true'}), (['-v', '--version'], {'version': 'nElex version 2.4.3n', 'action': 'version'}), (['--results-level'], {'help': 'Specify reporting level for results.', 'action': 'store', 'default': 'ru'}), (['--officeids'], {'help': 'Specify officeids to parse.', 'action': 'store', 'default': None}), (['--raceids'], {'help': 'Specify raceids to parse.', 'action': 'store', 'default': []}), (['--set-zero-counts'], {'help': 'Override results with zeros; omits the winner indicator.Sets the vote, delegate, and reporting precinct counts to zero.', 'action': 'store_true', 'default': False}), (['--national-only'], {'help': 'Limit results to national-level results only.', 'action': 'store_true', 'default': None}), (['--local-only'], {'help': 'Limit results to local-level results only.', 'action': 'store_true', 'default': None}), (['--with-timestamp'], {'help': 'Append a `timestamp` column to each row of data output with current system timestamp.', 'action': 'store_true'}), (['--batch-name'], {'help': 'Specify a value for a `batchname` column to append to each row.', 'action': 'store'})]
default
()
races
()elexraces<electiondate>
Returns race data for a given election date.
Command:
Example output:
id | raceid | racetype | racetypeid | description | electiondate | initialization_data | is_ballot_measure | lastupdated | national | officeid | officename | party | seatname | seatnum | statename | statepostal | test | uncontested |
2919 | 2919 | Caucus | E | 2016-03-26 | True | False | 2016-03-27T03:03:54Z | True | P | President | Dem | AK | False | False | ||||
12975 | 12975 | Caucus | E | 2016-03-26 | True | False | 2016-03-29T17:17:41Z | True | P | President | Dem | HI | False | False | ||||
… |
reporting_units
()elexreporting-units<electiondate>
Returns reporting unit data for a given election date.
Reporting units represent geographic aggregation of voting data at thenational, state, county, and district level.
Command:
Dead Space Console Commands Download
candidate_reporting_units
()elexcandidate-reporting-units<electiondate>
Returns candidate reporting unit data for a given election date.
A candidate reporting unit is a container for the results of a votingin a specific reporting unit. This command is a close cousin ofelex results <electiondate>.
This command does not return results.
Command:
Notes:
This command can be used to quickly create schemas.
Will output:
candidates
()elexcandidates<electiondate>
Returns candidate data for a given election date.
Command:
Example output:
id | candidateid | ballotorder | first | last | party | polid | polnum |
polid-1445 | 6527 | 2 | Bernie | Sanders | Dem | 1445 | 4262 |
polid-1746 | 6526 | 1 | Hillary | Clinton | Dem | 1746 | 4261 |
… |
ballot_measures
()elexballot-measures<electiondate>
Returns ballot measure data for a given election date.
Command:
Example output:
id | candidateid | ballotorder | description | electiondate | last | polid | polnum | seatname |
2016-03-15-43697 | 43697 | 1 | 2016-03-15 | For | 37229 | Public Improvement Bonds | ||
2016-03-15-43698 | 43698 | 2 | 2016-03-15 | Against | 37230 | Public Improvement Bonds | ||
… |
results
()elexresults<electiondate>
Returns result data.
Each row in the output represents a fully flattened anddenormalized version of a result for specific candidate ina specific race.
Command:
Example output:
id | unique_id | raceid | racetype | racetypeid | ballotorder | candidateid | description | delegatecount | electiondate | fipscode | first | incumbent | initialization_data | is_ballot_measure | last | lastupdated | level | national | officeid | officename | party | polid | polnum | precinctsreporting | precinctsreportingpct | precinctstotal | reportingunitid | reportingunitname | runoff | seatname | seatnum | statename | statepostal | test | uncontested | votecount | votepct | winner |
3021-polid-61815-state-1 | 3021 | Caucus | S | 2 | 6528 | 0 | 2016-03-01 | Ted | False | False | False | Cruz | 2016-03-02T17:05:46Z | state | True | P | President | GOP | 61815 | 4263 | 72 | 1.0 | 72 | state-1 | False | Alaska | AK | False | False | 7973 | 0.363566 | True | ||||||
3021-polid-8639-state-1 | 3021 | Caucus | S | 5 | 6548 | 0 | 2016-03-01 | Donald | False | False | False | Trump | 2016-03-02T17:05:46Z | state | True | P | President | GOP | 8639 | 4273 | 72 | 1.0 | 72 | state-1 | False | Alaska | AK | False | False | 7346 | 0.334975 | False | ||||||
… |
elections
()elexelections
Returns all elections known to the API.
Command:
Example output:
2016-02-09 | 2016-02-09 | True | False |
2016-02-16 | 2016-02-16 | True | False |
… |
delegates
()elexdelegates
Returns delegate report data.
Command:
Example output:
level | party_total | superdelegates_count | last | state | candidateid | party_need | party | delegates_count | id | d1 | d7 | d30 |
state | 2472 | 0 | Bush | MN | 1239 | 1237 | GOP | 0 | MN-1239 | 0 | 0 | 0 |
state | 2472 | 0 | Bush | OR | 1239 | 1237 | GOP | 0 | OR-1239 | 0 | 0 | 0 |
governor_trends
()elexgovernor-trends
Governor balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | Governor | 7 | 7 | 12 | 19 | 20 | 0 | -1 | 0 |
house_trends
()elexhouse-trends
House balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | U.S. House | 201 | 201 | 0 | 201 | 193 | 0 | +8 | 0 |
senate_trends
()elexsenate-trends
Senate balance of power/trend report.
Command:
Example output:
party | office | won | leading | holdovers | winning_trend | current | insufficient_vote | net_winners | net_leaders |
Dem | U.S. Senate | 23 | 23 | 30 | 53 | 51 | 0 | +2 | 0 |
next_election
()elexnext-election<date-after>
Returns data about the next election with an optional dateto start searching.
Command:
Example output:
id | electiondate | liveresults | testresults |
2016-04-19 | 2016-04-19 | False | True |
You can also specify the date to find the next election after, e.g.:
This will find the first election after April 15, 2016.
clear_cache
()elexclear-cache
Returns data about the next election with an optional dateto start searching.
Command:
If no cache entries exist, elex will close with exit code 65.
elex.cli.app.
ElexApp
(label=None, **kw)Meta
label
= 'elex'
base_controller
alias of ElexBaseController
exit_on_close
= True
hooks
= [('post_setup', <function cachecontrol_logging_hook>), ('post_argument_parsing', <function add_election_hook>)]
extensions
= ['elex.cli.ext_csv', 'elex.cli.ext_json']
output_handler
= 'csv'
handler_override_options
= {'output': (['-o'], {'help': 'output format (default: csv)'})}
log_handler
= <cement.ext.ext_logging.LoggingLogHandler object>
elex.cli.app.
main
()
elex.cli.decorators¶
elex.cli.decorators.
require_date_argument
(fn)¶Decorator that checks for date argument.
elex.cli.decorators.
require_ap_api_key
(fn)¶Decorator that checks for Associated Press API key or¶
overridable
= True¶
render
(data, template=None)¶
elex.cli.ext_csv.
load
(app)¶
elex.cli.ext_json¶
elex.cli.ext_json.
ElexJSONOutputHandler
(*args, **kw)¶A custom JSON output handler
- class
Meta
¶ label
= 'json'¶
overridable
= True¶
render
(data, template=None)¶
elex.cli.ext_json.
load
(app)¶
elex.cli.hooks¶
elex.cli.hooks.
add_election_hook
(app)¶Cache election API object reference after parsing args.
elex.cli.hooks.
cachecontrol_logging_hook
(app)¶Reroute cachecontrol logger to use cement log handlers.
elex.cli.utils¶
elex.cli.utils.
parse_date
(datestring)¶Parse many date formats into an AP friendly format.