<commit_before>'''
Created on Aug 14, 2014

@author: chorows
'''

import os
import sys
import argparse

#import __main__

class AddConfig(argparse.Action):
    def __init__(self, *args, **kwargs):
        argparse.Action.__init__(self, *args, **kwargs)
        
    def __call__(self, parser, namespace, values, option_string=None):
        with open(values,'r') as f:
            opts = [l.split('#')[0].strip() for l in f]
        parser.parse_args(args=opts, namespace=namespace) 

class KaldiArgumentParser(argparse.ArgumentParser):
    def __init__(self, *args, **kwargs):
        kwargs['add_help']=False
        #kwargs['fromfile_prefix_chars']='--config='
        version = kwargs.pop('version', None)
        super(KaldiArgumentParser, self).__init__(*args, **kwargs)
        self.version = version
        
    def add_standard_arguments(self):
        grp = self.add_argument_group('Standard options')

        default_prefix = '-' 
        grp.add_argument(
            default_prefix+'h', default_prefix*2+'help',
            action='help', default=argparse.SUPPRESS,<commit_msg>With printing of defaults in help messages<commit_after>'''
Created on Aug 14, 2014

@author: chorows
'''

import os
import sys
import argparse

#import __main__

class AddConfig(argparse.Action):
    def __init__(self, *args, **kwargs):
        argparse.Action.__init__(self, *args, **kwargs)
        
    def __call__(self, parser, namespace, values, option_string=None):
        with open(values,'r') as f:
            opts = [l.split('#')[0].strip() for l in f]
        parser.parse_args(args=opts, namespace=namespace) 

class KaldiArgumentParser(argparse.ArgumentParser):
    def __init__(self, *args, **kwargs):
        kwargs['add_help']=False
        #kwargs['fromfile_prefix_chars']='--config='
        version = kwargs.pop('version', None)
        super(KaldiArgumentParser, self).__init__(*args, formatter_class=argparse.ArgumentDefaultsHelpFormatter, **kwargs)
        self.version = version
        
    def add_standard_arguments(self):
        grp = self.add_argument_group('Standard options')

        default_prefix = '-' 
        grp.add_argument(
            default_prefix+'h', default_prefix*2+'help',
            action='help', default=argparse.SUPPRESS,
{'fraction_non_alphanumeric': 0.13001322168356105, 'fraction_numerical': 0.007051564565888057, 'mean_word_length': 3.323809523809524, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7033825', 'n_tokens_mistral': 693, 'n_tokens_neox': 675, 'n_words': 146}