Module Expr Str Import alias ImportFrom alias ClassDef bases NameLoad body Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return ListComp SubscriptLoad NameLoad Index Str comprehension NameStore Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Return ListComp TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str comprehension NameStore Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Dict Str NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str decorator_list FunctionDef arguments args NameParam NameParam defaults body If SubscriptLoad NameLoad Index Str body Return Str Return Call AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad If CompareEq NameLoad Num body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad Dict Str Str Str Str Str Call AttributeLoad Str attr TupleLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str Str SubscriptLoad NameLoad Index Str Dict Str Str Str Str Str Call AttributeLoad Str attr TupleLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str Str SubscriptLoad NameLoad Index Str orelse Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareEq NameLoad Num body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Dict Str Str Str Str Str Call AttributeLoad Str attr TupleLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str AttributeLoad NameLoad attr Str Str Str Str SubscriptLoad NameLoad Index Str orelse If CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad Assign NameStore Dict Str Str Str Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd NameLoad CompareGt Call NameLoad NameLoad Num body For NameStore ListLoad Str Str body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign NameStore BinOpAdd AttributeLoad NameLoad attr Str Assign NameStore Dict Str NameLoad Assign NameStore Call NameLoad NameLoad If BoolOpAnd NameLoad CompareGt NameLoad Num body Assign SubscriptStore NameLoad Index Str NameLoad If CompareEq NameLoad Num body AugAssignAdd NameStore Str orelse AugAssignAdd NameStore Str orelse If CompareIn NameLoad TupleLoad Num Num body AugAssignAdd NameStore Str orelse AugAssignAdd NameStore Str AugAssignAdd NameStore Str Return BinOpMod NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str Str Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr Expr Call AttributeLoad NameLoad attr ListLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Assign NameStore Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad NameLoad attr body Assign NameStore Dict Str Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str For NameStore TupleLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd NameLoad CompareGt Call NameLoad NameLoad Num body For NameStore ListLoad Str Str body For NameStore TupleLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad body Assign NameStore Dict Str Str NameLoad Str If BoolOpAnd CompareEq NameLoad Str CompareIn Call NameLoad NameLoad TupleLoad Num Num body Assign NameStore Str Assign NameStore BinOpAdd AttributeLoad NameLoad attr NameLoad If NameLoad body AugAssignAdd NameStore Str orelse If CompareNotIn Call NameLoad NameLoad TupleLoad Num Num body AugAssignAdd NameStore Str If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Str AugAssignAdd NameStore Str If CompareIn Call NameLoad NameLoad TupleLoad Num Num body AugAssignAdd NameStore Str orelse AugAssignAdd NameStore Str Return BinOpMod NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr Expr Call AttributeLoad NameLoad attr ListLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr If CompareIn Str Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Assign NameStore BinOpAdd Call AttributeLoad Str attr NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Assign NameStore Call AttributeLoad NameLoad attr Str BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Assign NameStore Dict Str Str Str Str If NameLoad body Return SubscriptLoad NameLoad Index NameLoad orelse Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call AttributeLoad NameLoad attr Str body Assign NameStore Str orelse Assign NameStore Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotEq SubscriptLoad NameLoad Index Str Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Str AttributeLoad NameLoad attr Str Str Str Return Dict Str Str Str Str Str BinOpAdd Call AttributeLoad Str attr NameLoad Str SubscriptLoad SubscriptLoad NameLoad Index Str Index Num Str Str SubscriptLoad NameLoad Index Str decorator_list decorator_list
N/A N/A 
Standardize names of data files on Maryland State Board of Elections.

File-name convention on MD site (2004-2012):

    general election
        precinct:            countyname_by_precinct_year_general.csv
        state leg. district: state_leg_districts_year_general.csv
        county:              countyname_party_year_general.csv

    primary election
        precinct:            countyname_by_Precinct_party_year_Primary.csv
        state leg. district: state_leg_districts_party_year_primary.csv
        county:              countyname_party_year_primary.csv

    Exceptions: 2000 + 2002

To run mappings from invoke task:

    invoke datasource.mappings -s md

 N/A re openelex.base.datasource BaseDatasource Datasource N/A BaseDatasource N/A N/A base_url http://www.elections.state.md.us/elections/%(year)s/election_data/ mappings N/A N/A self year N/A None N/A N/A Return array of dicts  containing source url and 
        standardized filename for raw results file, along 
        with other pieces of metadata
         N/A mappings N/A N/A N/A yr elecs N/A N/A N/A N/A self elections year items N/A N/A N/A N/A mappings extend N/A N/A self _build_metadata yr elecs N/A mappings N/A target_urls N/A N/A self year N/A None N/A N/A Get list of source data urls, optionally filtered by year N/A N/A N/A item N/A raw_url N/A item N/A N/A self mappings year N/A filename_url_pairs N/A N/A self year N/A None N/A N/A N/A N/A N/A item N/A generated_filename N/A item N/A raw_url N/A item N/A N/A self mappings year N/A _races_by_type N/A N/A self elections N/A N/A N/A Filter races by type and add election slug N/A races N/A special None N/A elec elections N/A N/A rtype N/A N/A self _race_type elec N/A N/A elec N/A slug N/A N/A self _election_slug elec N/A N/A races N/A rtype elec N/A N/A N/A races N/A general N/A races N/A primary N/A races N/A special N/A _race_type N/A N/A self election N/A N/A N/A N/A election N/A special N/A N/A special N/A N/A N/A N/A election N/A race_type lower N/A _build_metadata N/A N/A self year elections N/A N/A N/A year_int N/A int year N/A N/A year_int 2002 N/A N/A N/A general primary special N/A N/A self _races_by_type elections N/A meta N/A N/A generated_filename raw_url ocd_id name election N/A N/A __ join N/A N/A N/A N/A general N/A start_date replace - N/A self state general.txt N/A N/A self _get_2002_source_urls general ocd-division/country:us/state:md Maryland N/A general N/A slug N/A generated_filename raw_url ocd_id name election N/A N/A __ join N/A N/A N/A N/A primary N/A start_date replace - N/A self state primary.txt N/A N/A self _get_2002_source_urls primary ocd-division/country:us/state:md Maryland N/A primary N/A slug N/A N/A meta N/A N/A N/A self _state_leg_meta year elections N/A N/A self _county_meta year elections N/A N/A year_int 2000 N/A N/A N/A general primary special N/A N/A self _races_by_type elections N/A N/A N/A meta append N/A generated_filename raw_url ocd_id name election N/A N/A __ join N/A N/A N/A N/A primary N/A start_date replace - N/A self state primary.csv http://www.elections.state.md.us/elections/2000/results/prepaa.csv ocd-division/country:us/state:md Maryland N/A primary N/A slug N/A N/A N/A year_int 2008 N/A N/A N/A N/A meta append N/A N/A self _special_meta_2008 elections N/A meta N/A _state_leg_meta N/A N/A self year elections N/A N/A N/A payload N/A N/A meta N/A ocd_id name ocd-division/country:us/state:md/sldl:all State Legislative Districts N/A N/A general primary special N/A N/A self _races_by_type elections N/A general_url N/A N/A self _build_state_leg_url year N/A general_filename N/A N/A self _generate_state_leg_filename general_url N/A general N/A start_date N/A gen_meta N/A N/A meta copy N/A N/A N/A gen_meta update N/A raw_url generated_filename election general_url general_filename N/A general N/A slug N/A N/A N/A payload append gen_meta N/A N/A primary N/A N/A int year 2000 N/A N/A party N/A Democratic Republican N/A N/A pri_meta N/A N/A meta copy N/A primary_url N/A N/A self _build_state_leg_url year party N/A primary_filename N/A N/A self _generate_state_leg_filename primary_url N/A primary N/A start_date N/A N/A N/A pri_meta update N/A raw_url generated_filename election primary_url primary_filename N/A primary N/A slug N/A N/A N/A payload append pri_meta N/A payload N/A _build_state_leg_url N/A N/A self year party N/A N/A N/A tmplt N/A N/A self base_url State_Legislative_Districts N/A kwargs N/A year year N/A year_int N/A int year N/A N/A party N/A year_int 2000 N/A N/A N/A kwargs N/A party party N/A N/A year_int 2004 N/A N/A tmplt _%(party)s_Primary_%(year)s N/A N/A tmplt _%(party)s_%(year)s_Primary N/A N/A N/A year_int N/A 2000 2004 N/A N/A tmplt _General_%(year)s N/A N/A tmplt _%(year)s_General N/A tmplt .csv N/A N/A tmplt kwargs N/A _generate_state_leg_filename N/A N/A self url start_date N/A N/A N/A bits N/A N/A N/A start_date replace - N/A N/A N/A self state lower N/A matches N/A N/A self _apply_party_racetype_regex url N/A N/A matches N/A party N/A N/A N/A N/A bits append N/A N/A N/A matches N/A party lower N/A N/A N/A bits extend N/A N/A N/A N/A matches N/A race_type lower state_legislative.csv N/A name N/A N/A __ join bits N/A name N/A _county_meta N/A N/A self year elections N/A N/A N/A payload N/A N/A N/A general primary special N/A N/A self _races_by_type elections N/A jurisdiction N/A N/A self _jurisdictions N/A N/A meta N/A ocd_id name N/A jurisdiction N/A ocd_id N/A jurisdiction N/A name N/A county N/A jurisdiction N/A url_name N/A precinct_val N/A True False N/A N/A general_url N/A N/A self _build_county_url year county precinct precinct_val N/A general_filename N/A N/A self _generate_county_filename general_url N/A general N/A start_date jurisdiction N/A gen_meta N/A N/A meta copy N/A N/A N/A gen_meta update N/A raw_url generated_filename election general_url general_filename N/A general N/A slug N/A N/A N/A payload append gen_meta N/A N/A primary N/A N/A int year 2000 N/A N/A party N/A Democratic Republican N/A N/A precinct_val N/A True False N/A N/A pri_meta N/A N/A meta copy N/A primary_url N/A N/A self _build_county_url year county party precinct_val N/A primary_filename N/A N/A self _generate_county_filename primary_url N/A primary N/A start_date jurisdiction N/A N/A N/A pri_meta update N/A raw_url generated_filename election primary_url primary_filename N/A primary N/A slug N/A N/A N/A payload append pri_meta N/A payload N/A _build_county_url N/A N/A self year name party precinct N/A False N/A N/A url_kwargs N/A year race_type year General N/A N/A N/A name St._Marys N/A N/A int year N/A 2000 2004 N/A N/A name Saint_Marys N/A tmplt N/A N/A self base_url name N/A precinct N/A N/A tmplt _By_Precinct N/A N/A N/A N/A int year N/A 2000 2004 N/A N/A tmplt _County N/A party N/A N/A N/A url_kwargs N/A party party N/A N/A url_kwargs N/A race_type Primary N/A tmplt _%(party)s N/A N/A N/A int year N/A 2000 2004 N/A N/A tmplt _%(race_type)s_%(year)s.csv N/A N/A tmplt _%(year)s_%(race_type)s.csv N/A N/A tmplt url_kwargs N/A _generate_county_filename N/A N/A self url start_date jurisdiction N/A N/A N/A bits N/A N/A N/A start_date replace - N/A self state N/A matches N/A N/A self _apply_party_racetype_regex url N/A N/A matches N/A party N/A N/A N/A N/A bits append N/A N/A N/A matches N/A party lower N/A N/A N/A bits extend N/A N/A N/A N/A matches N/A race_type lower N/A N/A N/A jurisdiction N/A url_name lower N/A N/A by_precinct N/A N/A url lower N/A N/A N/A N/A bits append precinct N/A filename N/A N/A N/A __ join bits .csv N/A filename N/A _apply_party_racetype_regex N/A N/A self url N/A N/A N/A N/A N/A re search (2000|2004) url N/A N/A pattern N/A N/A re compile 
                (?P<party>Democratic|Republican)?
                _
                (?P<race_type>General|Primary) N/A N/A re IGNORECASE N/A re VERBOSE N/A N/A pattern N/A N/A re compile 
                (?P<party>Democratic|Republican)?
                _\d{4}_
                (?P<race_type>General|Primary) N/A N/A re IGNORECASE N/A re VERBOSE N/A matches N/A N/A N/A N/A re search pattern url groupdict N/A matches N/A _get_2002_source_urls N/A N/A self race_type N/A N/A N/A urls N/A general primary http://www.elections.state.md.us/elections/2002/results/g_all_offices.txt http://www.elections.state.md.us/elections/2002/results/p_all_offices.txt N/A race_type N/A N/A N/A urls N/A race_type N/A N/A N/A N/A urls values N/A _generate_2002_filename N/A N/A self url N/A N/A N/A N/A N/A url endswith g_all_offices.txt N/A N/A filename 20021105__md__general.txt N/A N/A filename 20020910__md__primary.txt N/A filename N/A _jurisdictions N/A N/A self N/A N/A N/A Maryland counties, plus Baltimore City N/A m N/A N/A self jurisdiction_mappings N/A mappings N/A x N/A x m N/A N/A x N/A url_name N/A mappings N/A _special_meta_2008 N/A N/A self elections N/A N/A N/A 
        Return metadata for 2008 Special 4th Congressional General Election.
         N/A N/A general primary special N/A N/A self _races_by_type elections N/A filename_bits N/A N/A N/A N/A special N/A start_date replace - N/A self state special general us_house_of_representatives__4 N/A N/A generated_filename raw_url ocd_id name election N/A N/A N/A __ join filename_bits .html N/A N/A special N/A direct_links N/A 0 ocd-division/country:us/state:md Maryland N/A special N/A slug N/A N/A