Module ImportFrom alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias identifier ImportFrom alias alias alias ImportFrom alias ImportFrom alias alias ImportFrom alias Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str Call AttributeLoad NameLoad attr Str keyword Str keyword Str Call AttributeLoad NameLoad attr Str keyword Str Call AttributeLoad NameLoad attr Str keyword Str Call AttributeLoad NameLoad attr Str keyword Str Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str keyword Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Dict If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad If NameLoad body Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad NameLoad orelse Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad NameLoad Expr Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad keyword NameLoad keyword NameLoad attr keyword NameLoad keyword NameLoad decorator_list Call AttributeLoad NameLoad attr keyword Str keyword Str NameLoad FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad Return Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Str decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return ListComp TupleLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str SubscriptLoad NameLoad Index Str comprehension NameStore Call NameLoad NameLoad NameLoad decorator_list Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str keyword Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad If BoolOpOr CompareIs NameLoad NameLoad Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad orelse If CompareIs NameLoad NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad TupleLoad NameLoad NameLoad For TupleStore NameStore NameStore NameLoad body If CompareIsNot NameLoad NameLoad body Assign NameStore ListLoad NameLoad orelse Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad keyword NameLoad keyword NameLoad attr keyword NameLoad keyword NameLoad decorator_list Call AttributeLoad NameLoad attr keyword Str keyword Str NameLoad FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore Dict Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str If NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad For NameStore Call NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword SubscriptLoad NameLoad Index Str keyword NameLoad Assign SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str Assign NameStore Str If NameLoad body Print Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num If UnaryOpNot BoolOpAnd NameLoad NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Call AttributeLoad NameLoad attr keyword Str keyword Str Call AttributeLoad NameLoad attr Str keyword Str Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str Call AttributeLoad NameLoad attr Str keyword Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str SubscriptLoad SubscriptLoad NameLoad Index Str Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str AttributeLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Str attr SubscriptLoad NameLoad Index Str Call NameLoad NameLoad Call NameLoad NameLoad keyword NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad NameLoad Index BinOpAdd NameLoad Str Assign NameStore TupleLoad Str Str Str Str For NameStore NameLoad body If SubscriptLoad NameLoad Index BinOpAdd NameLoad Str body Return NameLoad If SubscriptLoad NameLoad Index BinOpAdd NameLoad Str body Return Str orelse Return Str decorator_list
N/A datetime datetime N/A json N/A os.path N/A re N/A sys N/A click openelex.api elections elec_api openelex.base.bake Baker RawBaker reporting_levels_for_election openelex.base.publish published_url openelex.lib format_date compose openelex.us STATE_POSTALS N/A BASE_OPTIONS N/A N/A N/A click option --state required True help Two-letter state-abbreviation, e.g. NY N/A N/A click option --fmt help Format of output files.  Can be 'csv' or 'json'. Defaults is 'csv'. default csv N/A N/A click option --outputdir help Directory where output files will be written.  Defaults to 'openelex/us/bakery' N/A N/A click option --electiontype help Only bake results for election of this type. Can be 'primary' or 'general'. Default is to bake results for all types of elections N/A N/A click option --level help Only bake results aggregated at this reporting level. Values can be things like 'precinct' or 'county'. Default is to bake results for all reporting levels. N/A N/A click option --raw help Bake raw results.  Default is to bake cleaned/standardized results is_flag True N/A STATE_FILE_OPTIONS N/A list BASE_OPTIONS N/A N/A N/A STATE_FILE_OPTIONS append N/A N/A click option --datefilter help Date specified in 'YYYY' or 'YYYY-MM-DD' format. Results will only be baked for elections with a start date matching the date string base_options N/A N/A f N/A N/A N/A Decorator for default options N/A decorator_stack N/A compose BASE_OPTIONS N/A N/A decorator_stack f N/A state_file_options N/A N/A f N/A N/A N/A Decorator for options for the state_file command N/A decorator_stack N/A compose STATE_FILE_OPTIONS N/A N/A decorator_stack f N/A state_file N/A N/A state fmt outputdir datefilter electiontype level raw N/A csv None None None None False N/A N/A 
    Writes election and candidate data, along with a manifest to structured
    files.

    Args:
        state: Required. Postal code for a state.  For example, "md".
        fmt: Format of output files.  This can be "csv" or "json".  Defaults
          to "csv".
        outputdir: Directory where output files will be written. Defaults to 
            "openelections/us/bakery"
        datefilter: Date specified in "YYYY" or "YYYY-MM-DD" used to filter
            elections before they are baked.
        electiontype: Election type. For example, general, primary, etc. 
        level: Reporting level of the election results.  For example, "state",
            "county", "precinct", etc. Value must be one of the options
            specified in openelex.models.Result.REPORTING_LEVEL_CHOICES.
        raw: Bake RawResult records instead of cleaned and transformed results.

     N/A timestamp N/A N/A datetime now N/A filter_kwargs N/A N/A electiontype N/A N/A N/A filter_kwargs N/A election_type electiontype N/A level N/A N/A N/A filter_kwargs N/A reporting_level level N/A raw N/A N/A baker N/A RawBaker state state datefilter datefilter filter_kwargs N/A N/A baker N/A Baker state state datefilter datefilter filter_kwargs N/A N/A N/A N/A N/A N/A N/A baker collect_items write fmt outputdir outputdir timestamp timestamp write_manifest outputdir outputdir timestamp timestamp N/A N/A N/A click command name bake.state_file help Write election and candidate data along with a manifest to structured files state_file_options get_elections N/A N/A state datefilter N/A None N/A N/A 
    Get all elections.

    Args:
        state: Required. Postal code for a state.  For example, "md".
        datefilter: Date specified in "YYYY" or "YYYYMMDD" used to filter
            elections before they are baked.

    Returns:
        A list of dictionaries, each describing an election for the specified
        state.  The elections are sorted by date.

     N/A elections N/A N/A elec_api find N/A N/A state upper N/A datefilter N/A N/A date_prefix N/A format_date datefilter N/A elections N/A elec N/A elec elections N/A N/A N/A elec N/A start_date startswith date_prefix N/A N/A sorted elections key N/A N/A N/A x N/A N/A x N/A start_date N/A get_election_dates_types N/A N/A state datefilter N/A None N/A N/A Get all election dates and types for a state N/A N/A N/A N/A N/A N/A elec N/A start_date replace - N/A elec N/A race_type N/A elec N/A get_elections state datefilter N/A N/A ELECTION_FILE_OPTIONS N/A list BASE_OPTIONS N/A N/A N/A ELECTION_FILE_OPTIONS append N/A N/A click option --datefilter help Day of year, specified in YYYYMMDD format. Results will only be baked for elections with a start date matching the date string.  Default is to bake results for all elections. election_file_options N/A N/A f N/A N/A N/A Decorator for options fo the election_file command N/A decorator_stack N/A compose ELECTION_FILE_OPTIONS N/A N/A decorator_stack f N/A election_file N/A N/A state fmt outputdir datefilter electiontype level raw N/A csv None None None None False N/A N/A 
    Write election and candidate data with one election per file.
     N/A timestamp N/A N/A datetime now N/A raw N/A N/A baker_cls RawBaker N/A N/A baker_cls Baker N/A N/A N/A datefilter None N/A N/A re match \d{4} datefilter N/A N/A elections N/A get_election_dates_types state datefilter N/A N/A N/A electiontype None N/A N/A msg You must specify the election type when baking results for a single date. N/A N/A N/A sys exit msg N/A elections N/A N/A datefilter electiontype N/A N/A election_date election_type elections N/A N/A N/A level None N/A N/A reporting_levels N/A level N/A N/A reporting_levels N/A reporting_levels_for_election state election_date election_type raw N/A reporting_level reporting_levels N/A N/A msg N/A N/A Baking {} level results for {} election on {}
 format reporting_level election_type election_date N/A N/A N/A N/A sys stdout write msg N/A baker N/A baker_cls state state datefilter election_date election_type election_type reporting_level reporting_level N/A N/A N/A N/A N/A N/A N/A baker collect_items write fmt outputdir outputdir timestamp timestamp write_manifest outputdir outputdir timestamp timestamp N/A N/A N/A click command name bake.election_file help Write election and candidate data with on election per file election_file_options result_urls N/A N/A election raw N/A False N/A N/A urls N/A N/A state N/A N/A election N/A state N/A postal N/A datefilter N/A N/A N/A election N/A start_date replace - N/A raw N/A N/A baker_cls RawBaker N/A N/A baker_cls Baker N/A level N/A reporting_levels_for_election state datefilter N/A election N/A race_type raw N/A N/A filename N/A N/A baker_cls filename csv state state datefilter datefilter election_type N/A election N/A race_type reporting_level level N/A N/A urls N/A level N/A published_url state filename raw N/A urls N/A results_status_json N/A N/A state bakeall outputdir N/A None False None N/A N/A 
    Output a JSON file describing available results for each election.

    The JSON is intended to be consumed by the results front-end website.

    Args:
        state (string): State abbreviation.
        bakeall (boolean): If true, bake metadata for all states instead of the
            specified state.
        outputdir (string): If ``all`` is true, files will be created in this
            directory.  If baking a single file, output is sent to stdout.

     N/A filename_tpl elections-{}.json N/A state N/A N/A N/A N/A json dumps N/A statuses_for_state state N/A N/A N/A sys exit 0 N/A N/A N/A bakeall outputdir N/A N/A msg You must specify a state or the --bakeall flag and an output directory N/A N/A N/A sys exit msg N/A state STATE_POSTALS N/A N/A statuses N/A statuses_for_state state N/A output_path N/A N/A N/A os path join outputdir N/A N/A filename_tpl format N/A N/A state lower N/A N/A open output_path w f N/A N/A N/A N/A json dump statuses f N/A N/A N/A click command name bake.results_status_json help Output a JSON file describing available results for each election N/A N/A click option --state help Two-letter state-abbreviation, e.g. NY N/A N/A click option --bakeall is_flag True help Bake metadata for all states instead of the specified state N/A N/A click option --outputdir help Create JSON files in this directory. If baking a single file. output is sent to stdout. statuses_for_state N/A N/A state N/A N/A N/A 
    Get metadata about available results for a state.

    Args:
        state (string): State abbreviation.

    Returns:
        A list of dictionaries where each dictionary represents information
        about a single election.

     N/A statuses N/A N/A election N/A get_elections state N/A N/A status N/A state start_date special year race_type results results_raw prez senate house gov state_officers state_leg state_level_status county_level_status precinct_level_status cong_dist_level_status state_leg_level_status N/A N/A election N/A state N/A postal N/A election N/A start_date N/A election N/A special N/A N/A N/A datetime strptime N/A election N/A start_date %Y-%m-%d year N/A election N/A race_type N/A result_urls election N/A result_urls election raw True N/A election N/A prez N/A election N/A senate N/A election N/A house N/A election N/A gov N/A election N/A state_officers N/A election N/A state_leg N/A reporting_level_status election state N/A reporting_level_status election county N/A reporting_level_status election precinct N/A reporting_level_status election cong_dist N/A reporting_level_status election state_leg N/A N/A N/A statuses append status N/A statuses N/A reporting_level_status N/A N/A election reporting_level N/A N/A N/A 
    Get the availability of results for a reporting level

    This uses provisional logic to prepare the metadata for the website
    launch for ONA 2014.  It is designed to show the likely availability of
    results with a minimum of backfilling the '{reporting_level}_level_status'.
    As we progress, we should just use the value of the 
    '{reporting_level}_level_status' fields.

    Args:
        election (dict): Election dict as returned by ``get_elections()``
        reporting_level (string): Reporting level ID.  Should be "state",
            "county", "precinct", "cong_dist" or "state_leg"

    Returns:
        Slug string representing the availability of results at this reporting
        level.  See hub.models.Election.LEVEL_STATUS_CHOICES in the dashboard
        app (https://github.com/openelections/dashboard) for values.

     N/A level_status N/A election N/A N/A reporting_level _level_status N/A levels N/A county precinct cong_dist state_leg N/A level levels N/A N/A N/A election N/A N/A level _level_status N/A N/A level_status N/A N/A election N/A N/A reporting_level _level N/A N/A yes N/A N/A no N/A