# Path: utils.py
# class Accumulator(object):
#     """Simple callable that returns its current value."""
#     def __init__(self, initial=0):
#         self.value = initial
# 
#     def __call__(self, incr=0):
#         oldvalue = self.value
#         self.value += incr
#         return oldvalue
# 
#     def getvalue(self):
#         return self.value
# 
# class DictSlicer(object):
#     def __init__(self, *ks):
#         self.ks = ks
# 
#     def __call__(self, d):
#         return dict(((k, v) for (k, v) in d.iteritems() if k in self.ks))


import sys
import re
import hashlib
from datetime import date
from functools import partial
from utils import Accumulator, DictSlicer
        ('Type of Assistance Transaction', 'assistance_type', 2),
        ('Record Type', 'record_type', 1),
        ('Correction/Late Indicator', 'correction_indicator', 1),
        ('Fiscal Year and Quarter Correction', 'fyq_correction', 5),
        ('Principal Place of Performance Code', 'ppop_code', 7),
        ('Principal Place of Performance (State)', 'ppop_state', 25),
        ('Principal Place of Performance (County or City)', 'ppop_county_or_city', 25),
        ('Principal Place of Performance Zip Code', 'ppop_zip_code', 9),
        ('Principal Place of Performance Congressional District', 'ppop_cd', 2),
        ('CFDA Program Title', 'cfda_title', 74),
        ('Federal Agency Name', 'agency_name', 72),
        ('State Name', 'state_name', 25),
        ('Project Description', 'project_description', 149),
        ('DUNS Number', 'duns', 9),
        ('DUNS Number PLUS 4', 'duns_plus_4', 4),
        ('Dun & Bradstreet Confidence Code', 'duns_conf_code', 2),
        ('Program Source/Treasury Account Symbol: Agency Code', 'program_source_agency_code', 2),
        ('Program Source/Treasury Account Symbol: Account Code', 'program_source_account_code', 4),
        ('Program Source/Treasury Account Symbol: Account Code (OPTIONAL)', 'program_source_account_code_opt', 3),
        ('Recipient Address Line 1', 'recipient_address1', 35),
        ('Recipient Address Line 2', 'recipient_address2', 35),
        ('Recipient Address Line 3', 'recipient_address3', 35),
        ('Face Value of Direct Loan/Load Guarantee', 'loan_face_value', 16),
        ('Original Subsidy Cost of the Direct Loan/Loan Guarantee', 'orig_loan_subsidy_cost', 16),
        ('Business Funds Indicator (BFI)', 'bfi', 3),
        ('Recipient Country Code', 'recipient_country_code', 3),
        ('Principal Place of Performance Country Code', 'ppop_country_code', 3),
        ('Unique Record Identifier', 'uri', 70)
    ]


# Path: utils.py
# class Accumulator(object):
#     """Simple callable that returns its current value."""
#     def __init__(self, initial=0):
#         self.value = initial
# 
#     def __call__(self, incr=0):
#         oldvalue = self.value
#         self.value += incr
#         return oldvalue
# 
#     def getvalue(self):
#         return self.value
# 
# class DictSlicer(object):
#     def __init__(self, *ks):
#         self.ks = ks
# 
#     def __call__(self, d):
#         return dict(((k, v) for (k, v) in d.iteritems() if k in self.ks))


# Path: faadsplus.py
import sys
import re
import hashlib
from datetime import date
from functools import partial
from utils import Accumulator, DictSlicer

        ('Type of Assistance Transaction', 'assistance_type', 2),
        ('Record Type', 'record_type', 1),
        ('Correction/Late Indicator', 'correction_indicator', 1),
        ('Fiscal Year and Quarter Correction', 'fyq_correction', 5),
        ('Principal Place of Performance Code', 'ppop_code', 7),
        ('Principal Place of Performance (State)', 'ppop_state', 25),
        ('Principal Place of Performance (County or City)', 'ppop_county_or_city', 25),
        ('Principal Place of Performance Zip Code', 'ppop_zip_code', 9),
        ('Principal Place of Performance Congressional District', 'ppop_cd', 2),
        ('CFDA Program Title', 'cfda_title', 74),
        ('Federal Agency Name', 'agency_name', 72),
        ('State Name', 'state_name', 25),
        ('Project Description', 'project_description', 149),
        ('DUNS Number', 'duns', 9),
        ('DUNS Number PLUS 4', 'duns_plus_4', 4),
        ('Dun & Bradstreet Confidence Code', 'duns_conf_code', 2),
        ('Program Source/Treasury Account Symbol: Agency Code', 'program_source_agency_code', 2),
        ('Program Source/Treasury Account Symbol: Account Code', 'program_source_account_code', 4),
        ('Program Source/Treasury Account Symbol: Account Code (OPTIONAL)', 'program_source_account_code_opt', 3),
        ('Recipient Address Line 1', 'recipient_address1', 35),
        ('Recipient Address Line 2', 'recipient_address2', 35),
        ('Recipient Address Line 3', 'recipient_address3', 35),
        ('Face Value of Direct Loan/Load Guarantee', 'loan_face_value', 16),
        ('Original Subsidy Cost of the Direct Loan/Loan Guarantee', 'orig_loan_subsidy_cost', 16),
        ('Business Funds Indicator (BFI)', 'bfi', 3),
        ('Recipient Country Code', 'recipient_country_code', 3),
        ('Principal Place of Performance Country Code', 'ppop_country_code', 3),
        ('Unique Record Identifier', 'uri', 70)
    ]


    offset_accumulator = Accumulator()