Module Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias Expr Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore SubscriptLoad NameLoad Index Str If CompareIn Str NameLoad body Assign NameStore Call NameLoad orelse Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore Call NameLoad Assign NameStore Call NameLoad ListLoad Str Str Str Str Str Str Str Str Str Str Str Assign NameStore Call NameLoad ListLoad Str Str Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Str Str Str Str Str Str Str Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign NameStore ListLoad With AttributeLoad NameLoad attr NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Str For NameStore NameLoad body If Call AttributeLoad NameLoad attr NameLoad body Continue If CompareEq Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str body Assign NameStore Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Str attr orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign SubscriptStore NameLoad Index Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Str attr Assign NameStore SubscriptLoad SubscriptLoad ListComp NameLoad comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr CompareEq Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num Index Str Expr Call AttributeLoad NameLoad attr Dict Str Str Str Str Str Str Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad SubscriptLoad NameLoad Index Str Call AttributeLoad Str attr NameLoad Call NameLoad NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareNotIn Call AttributeLoad SubscriptLoad NameLoad Index Str attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Dict Str Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Dict Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Str Str Str Str Str Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign NameStore ListLoad With AttributeLoad NameLoad attr NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Str For NameStore NameLoad body If Call AttributeLoad NameLoad attr NameLoad body Continue Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad If CompareIn Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr body Assign NameStore Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Assign NameStore NameLoad Assign NameStore Str orelse If CompareEq Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str body Assign NameStore NameLoad orelse Assign NameStore Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Str attr Print SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad ListComp SubscriptLoad NameLoad Index Str comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr CompareEq Call AttributeLoad SubscriptLoad NameLoad Index Str attr SubscriptLoad NameLoad Index Str Index Num Expr Call AttributeLoad NameLoad attr Dict Str Str Str Str Str Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad NameLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareNotIn Call AttributeLoad SubscriptLoad NameLoad Index Str attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Dict Str Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Dict Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list decorator_list
N/A N/A re N/A csv N/A unicodecsv openelex.base.load BaseLoader openelex.models RawResult openelex.lib.text ocd_type_id slugify datasource Datasource N/A 
Montana elections have pre-processed CSV county-level results files for elections beginning in 2000. Files are in the
https://github.com/openelections/openelections-data-mt repository. There also are some precinct-level files in both
Excel and PDF formats on the state election division site.
 LoadResults N/A object N/A N/A Entry point for data loading.

    Determines appropriate loader for file and triggers load process.

     run N/A N/A self mapping N/A N/A N/A election_id N/A mapping N/A pre_processed_url N/A N/A precinct election_id N/A N/A loader N/A MTPrecinctLoader N/A N/A loader N/A MTCountyLoader N/A N/A N/A loader run mapping N/A N/A MTBaseLoader N/A BaseLoader N/A N/A datasource N/A Datasource N/A target_offices N/A set N/A President U.S. Senate U.S. House Governor Secretary of State State Auditor Attorney General Superintendent of Public Instruction Clerk of Supreme Court State Senate State House N/A district_offices N/A set N/A U.S. House State Senate State House _skip_row N/A N/A self row N/A N/A N/A 
        Should this row be skipped?

        This should be implemented in subclasses.
         N/A False N/A N/A MTPrecinctLoader N/A MTBaseLoader N/A N/A 
    Loads Montana precinct-level results.

     load N/A N/A self N/A N/A N/A headers N/A candidate office district party county precinct votes winner N/A N/A self _common_kwargs N/A N/A self _build_common_election_kwargs N/A N/A N/A self _common_kwargs N/A reporting_level precinct N/A results N/A N/A N/A self _file_handle csvfile N/A N/A reader N/A N/A unicodecsv DictReader csvfile fieldnames headers encoding latin-1 N/A row reader N/A N/A N/A N/A self _skip_row row N/A N/A N/A N/A N/A N/A N/A row N/A precinct strip N/A N/A total_votes N/A int N/A N/A N/A row N/A votes strip N/A contest_winner N/A N/A N/A row N/A winner strip N/A N/A rr_kwargs N/A N/A N/A self _common_kwargs copy N/A N/A rr_kwargs N/A primary_party N/A N/A N/A row N/A party strip N/A N/A N/A rr_kwargs update N/A N/A self _build_contest_kwargs row N/A N/A N/A rr_kwargs update N/A N/A self _build_candidate_kwargs row N/A jurisdiction N/A N/A N/A row N/A precinct strip N/A county_ocd_id N/A N/A N/A c N/A c N/A N/A N/A self datasource _jurisdictions N/A N/A N/A N/A c N/A county upper N/A N/A N/A row N/A county upper N/A 0 N/A ocd_id N/A N/A N/A rr_kwargs update N/A party jurisdiction parent_jurisdiction ocd_id office district votes N/A N/A N/A row N/A party strip jurisdiction N/A row N/A county N/A N/A {}/precinct:{} format county_ocd_id N/A ocd_type_id jurisdiction N/A N/A N/A row N/A office strip N/A N/A N/A row N/A district strip N/A int N/A N/A N/A row N/A votes strip N/A N/A N/A results append N/A RawResult rr_kwargs N/A N/A N/A N/A RawResult objects insert results N/A _skip_row N/A N/A self row N/A N/A N/A N/A N/A N/A N/A row N/A office strip N/A self target_offices N/A _build_contest_kwargs N/A N/A self row N/A N/A N/A N/A office district N/A N/A N/A row N/A office strip N/A N/A N/A row N/A district strip N/A _build_candidate_kwargs N/A N/A self row N/A N/A N/A N/A full_name N/A N/A N/A row N/A candidate strip N/A N/A MTCountyLoader N/A MTBaseLoader N/A N/A 
    Loads Montana county-level results for 2003-2013 primary and general elections.

    Format:

    Montana has PDF files that have been converted to CSV files for elections after 2000.
    Header rows are identical except that precinct is not present.
     load N/A N/A self N/A N/A N/A headers N/A county office district party candidate votes N/A N/A self _common_kwargs N/A N/A self _build_common_election_kwargs N/A N/A N/A self _common_kwargs N/A reporting_level county N/A results N/A N/A N/A self _file_handle csvfile N/A N/A reader N/A N/A unicodecsv DictReader csvfile fieldnames headers encoding latin-1 N/A row reader N/A N/A N/A N/A self _skip_row row N/A N/A N/A rr_kwargs N/A N/A N/A self _common_kwargs copy N/A N/A N/A rr_kwargs update N/A N/A self _build_contest_kwargs row N/A N/A N/A rr_kwargs update N/A N/A self _build_candidate_kwargs row N/A N/A TOTAL N/A N/A N/A row N/A county upper N/A N/A votes N/A int N/A N/A N/A row N/A votes strip N/A ocd_id None N/A jurisdiction Total N/A N/A N/A N/A N/A N/A row N/A votes strip Withdrew N/A N/A votes None N/A N/A votes N/A int N/A N/A N/A row N/A votes strip N/A jurisdiction N/A N/A N/A row N/A county strip N/A N/A row N/A county N/A ocd_id N/A N/A N/A o N/A ocd_id N/A o N/A N/A N/A self datasource _jurisdictions N/A N/A N/A N/A row N/A county strip N/A o N/A county N/A 0 N/A N/A N/A rr_kwargs update N/A party jurisdiction ocd_id office district votes N/A N/A N/A row N/A party strip jurisdiction ocd_id N/A N/A N/A row N/A office strip N/A N/A N/A row N/A district strip votes N/A N/A N/A results append N/A RawResult rr_kwargs N/A N/A N/A N/A RawResult objects insert results N/A _skip_row N/A N/A self row N/A N/A N/A N/A N/A N/A N/A row N/A office strip N/A self target_offices N/A _build_contest_kwargs N/A N/A self row N/A N/A N/A N/A office district N/A N/A N/A row N/A office strip N/A N/A N/A row N/A district strip N/A _build_candidate_kwargs N/A N/A self row N/A N/A N/A N/A full_name N/A N/A N/A row N/A candidate strip N/A N/A