def add_batch(self, std_ent_cls_code, batch_entries=None,
                  credits=True, debits=False, eff_ent_date=None,
                  company_id=None):
        if batch_entries is None:
            batch_entries = list()

        entry_desc = self.get_entry_desc(std_ent_cls_code)

        batch_count = len(self.batches) + 1

        if not eff_ent_date:
            eff_ent_date = datetime.today() + timedelta(days=1)

        if credits and debits:
            serv_cls_code = '200'
        elif credits:
            serv_cls_code = '220'
        elif debits:
            serv_cls_code = '225'

        batch_header = BatchHeader(
            serv_cls_code=serv_cls_code,
            batch_id=batch_count,
            company_id=company_id or self.settings['company_id'],
            std_ent_cls_code=std_ent_cls_code,
            entry_desc=entry_desc,
            desc_date='',
            eff_ent_date=eff_ent_date.strftime('%y%m%d'),  # YYMMDD
            orig_stat_code='1',
            orig_dfi_id=self.settings['immediate_dest'][:8],
            company_name=self.settings['immediate_org_name']
        )

        entries = list()
        entry_counter = 1

        for record in batch_entries:

            entry = EntryDetail(std_ent_cls_code)

            entry.transaction_code = record.get('type')
            entry.recv_dfi_id = record.get('routing_number')

            if len(record['routing_number']) < 9:
                entry.calc_check_digit()
            else:
                entry.check_digit = record['routing_number'][8]

            entry.dfi_acnt_num = record['account_number']
            entry.amount = int(round(float(record['amount']) * 100))
            entry.ind_name = record['name'].upper()[:22]
            entry.trace_num = self.settings['immediate_dest'][:8] \
                + entry.validate_numeric_field(entry_counter, 7)

            entries.append((entry, record.get('addenda', [])))
            entry_counter += 1

        self.batches.append(FileBatch(batch_header, entries))
        self.set_control()
Test commit_hook._stash_unstaged leaves untracked files alone
dataset/ETHPy150Open travishathaway/python-ach/ach/builder.py/AchFile.add_batch--crossover with--dataset/ETHPy150Open sebdah/git-pylint-commit-hook/tests.py/TestHook.test_stash_unstaged_untracked