clean up some indent
This commit is contained in:
parent
d08f1ca586
commit
7ddcfcc1c3
4 changed files with 331 additions and 340 deletions
|
@ -1,338 +1,339 @@
|
||||||
state_postal_numeric = {
|
state_postal_numeric = {
|
||||||
'AL': 1,
|
'AL': 1,
|
||||||
'AK': 2,
|
'AK': 2,
|
||||||
'AZ': 4,
|
'AZ': 4,
|
||||||
'AR': 5,
|
'AR': 5,
|
||||||
'CA': 6,
|
'CA': 6,
|
||||||
'CO': 8,
|
'CO': 8,
|
||||||
'CT': 9,
|
'CT': 9,
|
||||||
'DE': 10,
|
'DE': 10,
|
||||||
'DC': 11,
|
'DC': 11,
|
||||||
'FL': 12,
|
'FL': 12,
|
||||||
'GA': 13,
|
'GA': 13,
|
||||||
'HI': 15,
|
'HI': 15,
|
||||||
'ID': 16,
|
'ID': 16,
|
||||||
'IL': 17,
|
'IL': 17,
|
||||||
'IN': 18,
|
'IN': 18,
|
||||||
'IA': 19,
|
'IA': 19,
|
||||||
'KS': 20,
|
'KS': 20,
|
||||||
'KY': 21,
|
'KY': 21,
|
||||||
'LA': 22,
|
'LA': 22,
|
||||||
'ME': 23,
|
'ME': 23,
|
||||||
'MD': 24,
|
'MD': 24,
|
||||||
'MA': 25,
|
'MA': 25,
|
||||||
'MI': 26,
|
'MI': 26,
|
||||||
'MN': 27,
|
'MN': 27,
|
||||||
'MS': 28,
|
'MS': 28,
|
||||||
'MO': 29,
|
'MO': 29,
|
||||||
'MT': 30,
|
'MT': 30,
|
||||||
'NE': 31,
|
'NE': 31,
|
||||||
'NV': 32,
|
'NV': 32,
|
||||||
'NH': 33,
|
'NH': 33,
|
||||||
'NJ': 34,
|
'NJ': 34,
|
||||||
'NM': 35,
|
'NM': 35,
|
||||||
'NY': 36,
|
'NY': 36,
|
||||||
'NC': 37,
|
'NC': 37,
|
||||||
'ND': 38,
|
'ND': 38,
|
||||||
'OH': 39,
|
'OH': 39,
|
||||||
'OK': 40,
|
'OK': 40,
|
||||||
'OR': 41,
|
'OR': 41,
|
||||||
'PA': 42,
|
'PA': 42,
|
||||||
'RI': 44,
|
'RI': 44,
|
||||||
'SC': 45,
|
'SC': 45,
|
||||||
'SD': 46,
|
'SD': 46,
|
||||||
'TN': 47,
|
'TN': 47,
|
||||||
'TX': 48,
|
'TX': 48,
|
||||||
'UT': 49,
|
'UT': 49,
|
||||||
'VT': 50,
|
'VT': 50,
|
||||||
'VA': 51,
|
'VA': 51,
|
||||||
'WA': 53,
|
'WA': 53,
|
||||||
'WV': 54,
|
'WV': 54,
|
||||||
'WI': 55,
|
'WI': 55,
|
||||||
'WY': 56,
|
'WY': 56,
|
||||||
}
|
}
|
||||||
|
|
||||||
countries = (
|
countries = (
|
||||||
('AF', 'Afghanistan'),
|
('AF', 'Afghanistan'),
|
||||||
('AX', 'Aland Islands'),
|
('AX', 'Aland Islands'),
|
||||||
('AL', 'Albania'),
|
('AL', 'Albania'),
|
||||||
('DZ', 'Algeria'),
|
('DZ', 'Algeria'),
|
||||||
('AS', 'American Samoa'),
|
('AS', 'American Samoa'),
|
||||||
('AD', 'Andorra'),
|
('AD', 'Andorra'),
|
||||||
('AO', 'Angola'),
|
('AO', 'Angola'),
|
||||||
('AI', 'Anguilla'),
|
('AI', 'Anguilla'),
|
||||||
('AQ', 'Antarctica'),
|
('AQ', 'Antarctica'),
|
||||||
('AG', 'Antigua and Barbuda'),
|
('AG', 'Antigua and Barbuda'),
|
||||||
('AR', 'Argentina'),
|
('AR', 'Argentina'),
|
||||||
('AM', 'Armenia'),
|
('AM', 'Armenia'),
|
||||||
('AW', 'Aruba'),
|
('AW', 'Aruba'),
|
||||||
('AU', 'Australia'),
|
('AU', 'Australia'),
|
||||||
('AT', 'Austria'),
|
('AT', 'Austria'),
|
||||||
('AZ', 'Azerbaijan'),
|
('AZ', 'Azerbaijan'),
|
||||||
('BS', 'Bahamas'),
|
('BS', 'Bahamas'),
|
||||||
('BH', 'Bahrain'),
|
('BH', 'Bahrain'),
|
||||||
('BD', 'Bangladesh'),
|
('BD', 'Bangladesh'),
|
||||||
('BB', 'Barbados'),
|
('BB', 'Barbados'),
|
||||||
('BY', 'Belarus'),
|
('BY', 'Belarus'),
|
||||||
('BE', 'Belgium'),
|
('BE', 'Belgium'),
|
||||||
('BZ', 'Belize'),
|
('BZ', 'Belize'),
|
||||||
('BJ', 'Benin'),
|
('BJ', 'Benin'),
|
||||||
('BM', 'Bermuda'),
|
('BM', 'Bermuda'),
|
||||||
('BT', 'Bhutan'),
|
('BT', 'Bhutan'),
|
||||||
('BO', 'Bolivia, Plurinational State of'),
|
('BO', 'Bolivia, Plurinational State of'),
|
||||||
('BQ', 'Bonaire, Saint Eustatius and Saba'),
|
('BQ', 'Bonaire, Saint Eustatius and Saba'),
|
||||||
('BA', 'Bosnia and Herzegovina'),
|
('BA', 'Bosnia and Herzegovina'),
|
||||||
('BW', 'Botswana'),
|
('BW', 'Botswana'),
|
||||||
('BV', 'Bouvet Island'),
|
('BV', 'Bouvet Island'),
|
||||||
('BR', 'Brazil'),
|
('BR', 'Brazil'),
|
||||||
('IO', 'British Indian Ocean Territory'),
|
('IO', 'British Indian Ocean Territory'),
|
||||||
('BN', 'Brunei Darussalam'),
|
('BN', 'Brunei Darussalam'),
|
||||||
('BG', 'Bulgaria'),
|
('BG', 'Bulgaria'),
|
||||||
('BF', 'Burkina Faso'),
|
('BF', 'Burkina Faso'),
|
||||||
('BI', 'Burundi'),
|
('BI', 'Burundi'),
|
||||||
('KH', 'Cambodia'),
|
('KH', 'Cambodia'),
|
||||||
('CM', 'Cameroon'),
|
('CM', 'Cameroon'),
|
||||||
('CA', 'Canada'),
|
('CA', 'Canada'),
|
||||||
('CV', 'Cape Verde'),
|
('CV', 'Cape Verde'),
|
||||||
('KY', 'Cayman Islands'),
|
('KY', 'Cayman Islands'),
|
||||||
('CF', 'Central African Republic'),
|
('CF', 'Central African Republic'),
|
||||||
('TD', 'Chad'),
|
('TD', 'Chad'),
|
||||||
('CL', 'Chile'),
|
('CL', 'Chile'),
|
||||||
('CN', 'China'),
|
('CN', 'China'),
|
||||||
('CX', 'Christmas Island'),
|
('CX', 'Christmas Island'),
|
||||||
('CC', 'Cocos (Keeling) Islands'),
|
('CC', 'Cocos (Keeling) Islands'),
|
||||||
('CO', 'Colombia'),
|
('CO', 'Colombia'),
|
||||||
('KM', 'Comoros'),
|
('KM', 'Comoros'),
|
||||||
('CG', 'Congo'),
|
('CG', 'Congo'),
|
||||||
('CD', 'Congo, The Democratic Republic of the'),
|
('CD', 'Congo, The Democratic Republic of the'),
|
||||||
('CK', 'Cook Islands'),
|
('CK', 'Cook Islands'),
|
||||||
('CR', 'Costa Rica'),
|
('CR', 'Costa Rica'),
|
||||||
('CI', "Cote D'ivoire"),
|
('CI', "Cote D'ivoire"),
|
||||||
('HR', 'Croatia'),
|
('HR', 'Croatia'),
|
||||||
('CU', 'Cuba'),
|
('CU', 'Cuba'),
|
||||||
('CW', 'Curacao'),
|
('CW', 'Curacao'),
|
||||||
('CY', 'Cyprus'),
|
('CY', 'Cyprus'),
|
||||||
('CZ', 'Czech Republic'),
|
('CZ', 'Czech Republic'),
|
||||||
('DK', 'Denmark'),
|
('DK', 'Denmark'),
|
||||||
('DJ', 'Djibouti'),
|
('DJ', 'Djibouti'),
|
||||||
('DM', 'Dominica'),
|
('DM', 'Dominica'),
|
||||||
('DO', 'Dominican Republic'),
|
('DO', 'Dominican Republic'),
|
||||||
('EC', 'Ecuador'),
|
('EC', 'Ecuador'),
|
||||||
('EG', 'Egypt'),
|
('EG', 'Egypt'),
|
||||||
('SV', 'El Salvador'),
|
('SV', 'El Salvador'),
|
||||||
('GQ', 'Equatorial Guinea'),
|
('GQ', 'Equatorial Guinea'),
|
||||||
('ER', 'Eritrea'),
|
('ER', 'Eritrea'),
|
||||||
('EE', 'Estonia'),
|
('EE', 'Estonia'),
|
||||||
('ET', 'Ethiopia'),
|
('ET', 'Ethiopia'),
|
||||||
('FK', 'Falkland Islands (Malvinas)'),
|
('FK', 'Falkland Islands (Malvinas)'),
|
||||||
('FO', 'Faroe Islands'),
|
('FO', 'Faroe Islands'),
|
||||||
('FJ', 'Fiji'),
|
('FJ', 'Fiji'),
|
||||||
('FI', 'Finland'),
|
('FI', 'Finland'),
|
||||||
('FR', 'France'),
|
('FR', 'France'),
|
||||||
('GF', 'French Guiana'),
|
('GF', 'French Guiana'),
|
||||||
('PF', 'French Polynesia'),
|
('PF', 'French Polynesia'),
|
||||||
('TF', 'French Southern Territories'),
|
('TF', 'French Southern Territories'),
|
||||||
('GA', 'Gabon'),
|
('GA', 'Gabon'),
|
||||||
('GM', 'Gambia'),
|
('GM', 'Gambia'),
|
||||||
('GE', 'Georgia'),
|
('GE', 'Georgia'),
|
||||||
('DE', 'Germany'),
|
('DE', 'Germany'),
|
||||||
('GH', 'Ghana'),
|
('GH', 'Ghana'),
|
||||||
('GI', 'Gibraltar'),
|
('GI', 'Gibraltar'),
|
||||||
('GR', 'Greece'),
|
('GR', 'Greece'),
|
||||||
('GL', 'Greenland'),
|
('GL', 'Greenland'),
|
||||||
('GD', 'Grenada'),
|
('GD', 'Grenada'),
|
||||||
('GP', 'Guadeloupe'),
|
('GP', 'Guadeloupe'),
|
||||||
('GU', 'Guam'),
|
('GU', 'Guam'),
|
||||||
('GT', 'Guatemala'),
|
('GT', 'Guatemala'),
|
||||||
('GG', 'Guernsey'),
|
('GG', 'Guernsey'),
|
||||||
('GN', 'Guinea'),
|
('GN', 'Guinea'),
|
||||||
('GW', 'Guinea-Bissau'),
|
('GW', 'Guinea-Bissau'),
|
||||||
('GY', 'Guyana'),
|
('GY', 'Guyana'),
|
||||||
('HT', 'Haiti'),
|
('HT', 'Haiti'),
|
||||||
('HM', 'Heard Island and McDonald Islands'),
|
('HM', 'Heard Island and McDonald Islands'),
|
||||||
('VA', 'Holy See (Vatican City State)'),
|
('VA', 'Holy See (Vatican City State)'),
|
||||||
('HN', 'Honduras'),
|
('HN', 'Honduras'),
|
||||||
('HK', 'Hong Kong'),
|
('HK', 'Hong Kong'),
|
||||||
('HU', 'Hungary'),
|
('HU', 'Hungary'),
|
||||||
('IS', 'Iceland'),
|
('IS', 'Iceland'),
|
||||||
('IN', 'India'),
|
('IN', 'India'),
|
||||||
('ID', 'Indonesia'),
|
('ID', 'Indonesia'),
|
||||||
('IR', 'Iran, Islamic Republic of'),
|
('IR', 'Iran, Islamic Republic of'),
|
||||||
('IQ', 'Iraq'),
|
('IQ', 'Iraq'),
|
||||||
('IE', 'Ireland'),
|
('IE', 'Ireland'),
|
||||||
('IM', 'Isle of Man'),
|
('IM', 'Isle of Man'),
|
||||||
('IL', 'Israel'),
|
('IL', 'Israel'),
|
||||||
('IT', 'Italy'),
|
('IT', 'Italy'),
|
||||||
('JM', 'Jamaica'),
|
('JM', 'Jamaica'),
|
||||||
('JP', 'Japan'),
|
('JP', 'Japan'),
|
||||||
('JE', 'Jersey'),
|
('JE', 'Jersey'),
|
||||||
('JO', 'Jordan'),
|
('JO', 'Jordan'),
|
||||||
('KZ', 'Kazakhstan'),
|
('KZ', 'Kazakhstan'),
|
||||||
('KE', 'Kenya'),
|
('KE', 'Kenya'),
|
||||||
('KI', 'Kiribati'),
|
('KI', 'Kiribati'),
|
||||||
('KP', "Korea, Democratic People's Republic of"),
|
('KP', "Korea, Democratic People's Republic of"),
|
||||||
('KR', 'Korea, Republic of'),
|
('KR', 'Korea, Republic of'),
|
||||||
('KW', 'Kuwait'),
|
('KW', 'Kuwait'),
|
||||||
('KG', 'Kyrgyzstan'),
|
('KG', 'Kyrgyzstan'),
|
||||||
('LA', "Lao People's Democratic Republic"),
|
('LA', "Lao People's Democratic Republic"),
|
||||||
('LV', 'Latvia'),
|
('LV', 'Latvia'),
|
||||||
('LB', 'Lebanon'),
|
('LB', 'Lebanon'),
|
||||||
('LS', 'Lesotho'),
|
('LS', 'Lesotho'),
|
||||||
('LR', 'Liberia'),
|
('LR', 'Liberia'),
|
||||||
('LY', 'Libyan Arab Jamahiriya'),
|
('LY', 'Libyan Arab Jamahiriya'),
|
||||||
('LI', 'Liechtenstein'),
|
('LI', 'Liechtenstein'),
|
||||||
('LT', 'Lithuania'),
|
('LT', 'Lithuania'),
|
||||||
('LU', 'Luxembourg'),
|
('LU', 'Luxembourg'),
|
||||||
('MO', 'Macao'),
|
('MO', 'Macao'),
|
||||||
('MK', 'Macedonia, The Former Yugoslav Republic of'),
|
('MK', 'Macedonia, The Former Yugoslav Republic of'),
|
||||||
('MG', 'Madagascar'),
|
('MG', 'Madagascar'),
|
||||||
('MW', 'Malawi'),
|
('MW', 'Malawi'),
|
||||||
('MY', 'Malaysia'),
|
('MY', 'Malaysia'),
|
||||||
('MV', 'Maldives'),
|
('MV', 'Maldives'),
|
||||||
('ML', 'Mali'),
|
('ML', 'Mali'),
|
||||||
('MT', 'Malta'),
|
('MT', 'Malta'),
|
||||||
('MH', 'Marshall Islands'),
|
('MH', 'Marshall Islands'),
|
||||||
('MQ', 'Martinique'),
|
('MQ', 'Martinique'),
|
||||||
('MR', 'Mauritania'),
|
('MR', 'Mauritania'),
|
||||||
('MU', 'Mauritius'),
|
('MU', 'Mauritius'),
|
||||||
('YT', 'Mayotte'),
|
('YT', 'Mayotte'),
|
||||||
('MX', 'Mexico'),
|
('MX', 'Mexico'),
|
||||||
('FM', 'Micronesia, Federated States of'),
|
('FM', 'Micronesia, Federated States of'),
|
||||||
('MD', 'Moldova, Republic of'),
|
('MD', 'Moldova, Republic of'),
|
||||||
('MC', 'Monaco'),
|
('MC', 'Monaco'),
|
||||||
('MN', 'Mongolia'),
|
('MN', 'Mongolia'),
|
||||||
('ME', 'Montenegro'),
|
('ME', 'Montenegro'),
|
||||||
('MS', 'Montserrat'),
|
('MS', 'Montserrat'),
|
||||||
('MA', 'Morocco'),
|
('MA', 'Morocco'),
|
||||||
('MZ', 'Mozambique'),
|
('MZ', 'Mozambique'),
|
||||||
('MM', 'Myanmar'),
|
('MM', 'Myanmar'),
|
||||||
('NA', 'Namibia'),
|
('NA', 'Namibia'),
|
||||||
('NR', 'Nauru'),
|
('NR', 'Nauru'),
|
||||||
('NP', 'Nepal'),
|
('NP', 'Nepal'),
|
||||||
('NL', 'Netherlands'),
|
('NL', 'Netherlands'),
|
||||||
('NC', 'New Caledonia'),
|
('NC', 'New Caledonia'),
|
||||||
('NZ', 'New Zealand'),
|
('NZ', 'New Zealand'),
|
||||||
('NI', 'Nicaragua'),
|
('NI', 'Nicaragua'),
|
||||||
('NE', 'Niger'),
|
('NE', 'Niger'),
|
||||||
('NG', 'Nigeria'),
|
('NG', 'Nigeria'),
|
||||||
('NU', 'Niue'),
|
('NU', 'Niue'),
|
||||||
('NF', 'Norfolk Island'),
|
('NF', 'Norfolk Island'),
|
||||||
('MP', 'Northern Mariana Islands'),
|
('MP', 'Northern Mariana Islands'),
|
||||||
('NO', 'Norway'),
|
('NO', 'Norway'),
|
||||||
('OM', 'Oman'),
|
('OM', 'Oman'),
|
||||||
('PK', 'Pakistan'),
|
('PK', 'Pakistan'),
|
||||||
('PW', 'Palau'),
|
('PW', 'Palau'),
|
||||||
('PS', 'Palestinian Territory, Occupied'),
|
('PS', 'Palestinian Territory, Occupied'),
|
||||||
('PA', 'Panama'),
|
('PA', 'Panama'),
|
||||||
('PG', 'Papua New Guinea'),
|
('PG', 'Papua New Guinea'),
|
||||||
('PY', 'Paraguay'),
|
('PY', 'Paraguay'),
|
||||||
('PE', 'Peru'),
|
('PE', 'Peru'),
|
||||||
('PH', 'Philippines'),
|
('PH', 'Philippines'),
|
||||||
('PN', 'Pitcairn'),
|
('PN', 'Pitcairn'),
|
||||||
('PL', 'Poland'),
|
('PL', 'Poland'),
|
||||||
('PT', 'Portugal'),
|
('PT', 'Portugal'),
|
||||||
('PR', 'Puerto Rico'),
|
('PR', 'Puerto Rico'),
|
||||||
('QA', 'Qatar'),
|
('QA', 'Qatar'),
|
||||||
('RE', 'Reunion'),
|
('RE', 'Reunion'),
|
||||||
('RO', 'Romania'),
|
('RO', 'Romania'),
|
||||||
('RU', 'Russian Federation'),
|
('RU', 'Russian Federation'),
|
||||||
('RW', 'Rwanda'),
|
('RW', 'Rwanda'),
|
||||||
('BL', 'Saint Barthelemy'),
|
('BL', 'Saint Barthelemy'),
|
||||||
('SH', 'Saint Helena, Ascension and Tristan Da Cunha'),
|
('SH', 'Saint Helena, Ascension and Tristan Da Cunha'),
|
||||||
('KN', 'Saint Kitts and Nevis'),
|
('KN', 'Saint Kitts and Nevis'),
|
||||||
('LC', 'Saint Lucia'),
|
('LC', 'Saint Lucia'),
|
||||||
('MF', 'Saint Martin (French Part)'),
|
('MF', 'Saint Martin (French Part)'),
|
||||||
('PM', 'Saint Pierre and Miquelon'),
|
('PM', 'Saint Pierre and Miquelon'),
|
||||||
('VC', 'Saint Vincent and the Grenadines'),
|
('VC', 'Saint Vincent and the Grenadines'),
|
||||||
('WS', 'Samoa'),
|
('WS', 'Samoa'),
|
||||||
('SM', 'San Marino'),
|
('SM', 'San Marino'),
|
||||||
('ST', 'Sao Tome and Principe'),
|
('ST', 'Sao Tome and Principe'),
|
||||||
('SA', 'Saudi Arabia'),
|
('SA', 'Saudi Arabia'),
|
||||||
('SN', 'Senegal'),
|
('SN', 'Senegal'),
|
||||||
('RS', 'Serbia'),
|
('RS', 'Serbia'),
|
||||||
('SC', 'Seychelles'),
|
('SC', 'Seychelles'),
|
||||||
('SL', 'Sierra Leone'),
|
('SL', 'Sierra Leone'),
|
||||||
('SG', 'Singapore'),
|
('SG', 'Singapore'),
|
||||||
('SX', 'Sint Maarten (Dutch Part)'),
|
('SX', 'Sint Maarten (Dutch Part)'),
|
||||||
('SK', 'Slovakia'),
|
('SK', 'Slovakia'),
|
||||||
('SI', 'Slovenia'),
|
('SI', 'Slovenia'),
|
||||||
('SB', 'Solomon Islands'),
|
('SB', 'Solomon Islands'),
|
||||||
('SO', 'Somalia'),
|
('SO', 'Somalia'),
|
||||||
('ZA', 'South Africa'),
|
('ZA', 'South Africa'),
|
||||||
('GS', 'South Georgia and the South Sandwich Islands'),
|
('GS', 'South Georgia and the South Sandwich Islands'),
|
||||||
('ES', 'Spain'),
|
('ES', 'Spain'),
|
||||||
('LK', 'Sri Lanka'),
|
('LK', 'Sri Lanka'),
|
||||||
('SD', 'Sudan'),
|
('SD', 'Sudan'),
|
||||||
('SR', 'Suriname'),
|
('SR', 'Suriname'),
|
||||||
('SJ', 'Svalbard and Jan Mayen'),
|
('SJ', 'Svalbard and Jan Mayen'),
|
||||||
('SZ', 'Swaziland'),
|
('SZ', 'Swaziland'),
|
||||||
('SE', 'Sweden'),
|
('SE', 'Sweden'),
|
||||||
('CH', 'Switzerland'),
|
('CH', 'Switzerland'),
|
||||||
('SY', 'Syrian Arab Republic'),
|
('SY', 'Syrian Arab Republic'),
|
||||||
('TW', 'Taiwan, Province of China'),
|
('TW', 'Taiwan, Province of China'),
|
||||||
('TJ', 'Tajikistan'),
|
('TJ', 'Tajikistan'),
|
||||||
('TZ', 'Tanzania, United Republic of'),
|
('TZ', 'Tanzania, United Republic of'),
|
||||||
('TH', 'Thailand'),
|
('TH', 'Thailand'),
|
||||||
('TL', 'Timor-Leste'),
|
('TL', 'Timor-Leste'),
|
||||||
('TG', 'Togo'),
|
('TG', 'Togo'),
|
||||||
('TK', 'Tokelau'),
|
('TK', 'Tokelau'),
|
||||||
('TO', 'Tonga'),
|
('TO', 'Tonga'),
|
||||||
('TT', 'Trinidad and Tobago'),
|
('TT', 'Trinidad and Tobago'),
|
||||||
('TN', 'Tunisia'),
|
('TN', 'Tunisia'),
|
||||||
('TR', 'Turkey'),
|
('TR', 'Turkey'),
|
||||||
('TM', 'Turkmenistan'),
|
('TM', 'Turkmenistan'),
|
||||||
('TC', 'Turks and Caicos Islands'),
|
('TC', 'Turks and Caicos Islands'),
|
||||||
('TV', 'Tuvalu'),
|
('TV', 'Tuvalu'),
|
||||||
('UG', 'Uganda'),
|
('UG', 'Uganda'),
|
||||||
('UA', 'Ukraine'),
|
('UA', 'Ukraine'),
|
||||||
('AE', 'United Arab Emirates'),
|
('AE', 'United Arab Emirates'),
|
||||||
('GB', 'United Kingdom'),
|
('GB', 'United Kingdom'),
|
||||||
('US', 'United States'),
|
('US', 'United States'),
|
||||||
('UM', 'United States Minor Outlying Islands'),
|
('UM', 'United States Minor Outlying Islands'),
|
||||||
('UY', 'Uruguay'),
|
('UY', 'Uruguay'),
|
||||||
('UZ', 'Uzbekistan'),
|
('UZ', 'Uzbekistan'),
|
||||||
('VU', 'Vanuatu'),
|
('VU', 'Vanuatu'),
|
||||||
('VE', 'Venezuela, Bolivarian Republic of'),
|
('VE', 'Venezuela, Bolivarian Republic of'),
|
||||||
('VN', 'Viet Nam'),
|
('VN', 'Viet Nam'),
|
||||||
('VG', 'Virgin Islands, British'),
|
('VG', 'Virgin Islands, British'),
|
||||||
('VI', 'Virgin Islands, U.S.'),
|
('VI', 'Virgin Islands, U.S.'),
|
||||||
('WF', 'Wallis and Futuna'),
|
('WF', 'Wallis and Futuna'),
|
||||||
('EH', 'Western Sahara'),
|
('EH', 'Western Sahara'),
|
||||||
('YE', 'Yemen'),
|
('YE', 'Yemen'),
|
||||||
('ZM', 'Zambia'),
|
('ZM', 'Zambia'),
|
||||||
('ZW', 'Zimbabwe'))
|
('ZW', 'Zimbabwe'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
employer_types = (
|
employer_types = (
|
||||||
('F','Federal Government'),
|
('F','Federal Government'),
|
||||||
('S','State and Local Governmental Employer'),
|
('S','State and Local Governmental Employer'),
|
||||||
('T','Tax Exempt Employer'),
|
('T','Tax Exempt Employer'),
|
||||||
('Y','State and Local Tax Exempt Employer'),
|
('Y','State and Local Tax Exempt Employer'),
|
||||||
('N','None Apply'),
|
('N','None Apply'),
|
||||||
)
|
)
|
||||||
|
|
||||||
employment_codes = (
|
employment_codes = (
|
||||||
('A', 'Agriculture'),
|
('A', 'Agriculture'),
|
||||||
('H', 'Household'),
|
('H', 'Household'),
|
||||||
('M', 'Military'),
|
('M', 'Military'),
|
||||||
('Q', 'Medicare Qualified Government Employee'),
|
('Q', 'Medicare Qualified Government Employee'),
|
||||||
('X', 'Railroad'),
|
('X', 'Railroad'),
|
||||||
('F', 'Regular'),
|
('F', 'Regular'),
|
||||||
('R', 'Regular (all others)'),
|
('R', 'Regular (all others)'),
|
||||||
)
|
)
|
||||||
|
|
||||||
tax_jurisdiction_codes = (
|
tax_jurisdiction_codes = (
|
||||||
('V', 'Virgin Islands'),
|
('V', 'Virgin Islands'),
|
||||||
('G', 'Guam'),
|
('G', 'Guam'),
|
||||||
('S', 'American Samoa'),
|
('S', 'American Samoa'),
|
||||||
('N', 'Northern Mariana Islands'),
|
('N', 'Northern Mariana Islands'),
|
||||||
('P', 'Puerto Rico'),
|
('P', 'Puerto Rico'),
|
||||||
)
|
)
|
||||||
|
|
||||||
tax_type_codes = (
|
tax_type_codes = (
|
||||||
('C', 'City Income Tax'),
|
('C', 'City Income Tax'),
|
||||||
('D', 'Country Income Tax'),
|
('D', 'Country Income Tax'),
|
||||||
('E', 'School District Income Tax'),
|
('E', 'School District Income Tax'),
|
||||||
('F', 'Other Income Tax'),
|
('F', 'Other Income Tax'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import decimal, datetime
|
||||||
import inspect
|
import inspect
|
||||||
from . import enums
|
from . import enums
|
||||||
|
|
||||||
|
|
||||||
class ValidationError(Exception):
|
class ValidationError(Exception):
|
||||||
def __init__(self, msg, field=None):
|
def __init__(self, msg, field=None):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
@ -90,14 +91,10 @@ class Field(object):
|
||||||
wrapper = textwrap.TextWrapper(replace_whitespace=False, drop_whitespace=False)
|
wrapper = textwrap.TextWrapper(replace_whitespace=False, drop_whitespace=False)
|
||||||
wrapper.width = 100
|
wrapper.width = 100
|
||||||
value = wrapper.wrap(value)
|
value = wrapper.wrap(value)
|
||||||
#value = textwrap.wrap(value, 100)
|
|
||||||
#print value
|
|
||||||
value = list([(" " * 9) + ('"' + x + '"') for x in value])
|
value = list([(" " * 9) + ('"' + x + '"') for x in value])
|
||||||
#value[0] = '"' + value[0] + '"'
|
|
||||||
value.append(" " * 10 + ('_' * 10) * (wrapper.width / 10))
|
value.append(" " * 10 + ('_' * 10) * (wrapper.width / 10))
|
||||||
value.append(" " * 10 + ('0123456789') * (wrapper.width / 10))
|
value.append(" " * 10 + ('0123456789') * (wrapper.width / 10))
|
||||||
value.append(" " * 10 + ''.join(([str(x) + (' ' * 9) for x in range(wrapper.width / 10 )])))
|
value.append(" " * 10 + ''.join(([str(x) + (' ' * 9) for x in range(wrapper.width / 10 )])))
|
||||||
#value.append((" " * 59) + map(lambda x:("%x" % x), range(16))
|
|
||||||
|
|
||||||
start = counter['c']
|
start = counter['c']
|
||||||
counter['c'] += len(self._orig_value or self.value)
|
counter['c'] += len(self._orig_value or self.value)
|
||||||
|
@ -146,7 +143,6 @@ class StateField(TextField):
|
||||||
self.use_numeric = use_numeric
|
self.use_numeric = use_numeric
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
# value = str(self.value or 'XX').encode('ascii') or b''
|
|
||||||
value = str(self.value or 'XX')
|
value = str(self.value or 'XX')
|
||||||
if value.strip() and self.use_numeric:
|
if value.strip() and self.use_numeric:
|
||||||
postcode = enums.state_postal_numeric[value.upper()]
|
postcode = enums.state_postal_numeric[value.upper()]
|
||||||
|
@ -199,6 +195,7 @@ class StaticField(TextField):
|
||||||
def parse(self, s):
|
def parse(self, s):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BlankField(TextField):
|
class BlankField(TextField):
|
||||||
def __init__(self, name=None, max_length=0, required=False):
|
def __init__(self, name=None, max_length=0, required=False):
|
||||||
super(TextField, self).__init__(name=name, max_length=max_length, required=required, uppercase=False)
|
super(TextField, self).__init__(name=name, max_length=max_length, required=required, uppercase=False)
|
||||||
|
@ -209,10 +206,12 @@ class BlankField(TextField):
|
||||||
def parse(self, s):
|
def parse(self, s):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ZeroField(BlankField):
|
class ZeroField(BlankField):
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
return b'0' * self.max_length
|
return b'0' * self.max_length
|
||||||
|
|
||||||
|
|
||||||
class CRLFField(TextField):
|
class CRLFField(TextField):
|
||||||
def __init__(self, name=None, required=False):
|
def __init__(self, name=None, required=False):
|
||||||
super(TextField, self).__init__(name=name, max_length=2, required=required, uppercase=False)
|
super(TextField, self).__init__(name=name, max_length=2, required=required, uppercase=False)
|
||||||
|
@ -231,6 +230,7 @@ class CRLFField(TextField):
|
||||||
def parse(self, s):
|
def parse(self, s):
|
||||||
self.value = s
|
self.value = s
|
||||||
|
|
||||||
|
|
||||||
class BooleanField(Field):
|
class BooleanField(Field):
|
||||||
def __init__(self, name=None, required=True, value=None):
|
def __init__(self, name=None, required=True, value=None):
|
||||||
super(BooleanField, self).__init__(name=name, required=required, max_length=1)
|
super(BooleanField, self).__init__(name=name, required=required, max_length=1)
|
||||||
|
@ -299,7 +299,6 @@ class DateField(TextField):
|
||||||
class MonthYearField(TextField):
|
class MonthYearField(TextField):
|
||||||
def __init__(self, name=None, required=True, value=None):
|
def __init__(self, name=None, required=True, value=None):
|
||||||
super(TextField, self).__init__(name=name, required=required, max_length=6)
|
super(TextField, self).__init__(name=name, required=required, max_length=6)
|
||||||
|
|
||||||
if value:
|
if value:
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
|
@ -326,4 +325,3 @@ class MonthYearField(TextField):
|
||||||
return self._value
|
return self._value
|
||||||
|
|
||||||
value = property(__getvalue, __setvalue)
|
value = property(__getvalue, __setvalue)
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,5 @@ class Model(object):
|
||||||
|
|
||||||
target._value = f._value
|
target._value = f._value
|
||||||
|
|
||||||
|
|
||||||
#print (self.__dict__[f.name].name == f.name)
|
|
||||||
#self.__dict__[f.name].name == f.name
|
|
||||||
#self.__dict__[f.name].max_length == f.max_length
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# coding=UTF-8
|
|
||||||
"""
|
"""
|
||||||
Parser utility to read data from Publication 1220 and
|
Parser utility to read data from Publication 1220 and
|
||||||
convert it into python classes.
|
convert it into python classes.
|
||||||
|
@ -146,8 +144,7 @@ class RecordBuilder(object):
|
||||||
(re.compile(r'zero\-filled', re.IGNORECASE), +1),
|
(re.compile(r'zero\-filled', re.IGNORECASE), +1),
|
||||||
(re.compile(r'leading zeroes', re.IGNORECASE), +1),
|
(re.compile(r'leading zeroes', re.IGNORECASE), +1),
|
||||||
|
|
||||||
(re.compile(r'left-\justif', re.IGNORECASE), -1),
|
(re.compile(r'left\-justif', re.IGNORECASE), -1),
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue