<commit_before>#!/usr/bin/env python
from __future__ import absolute_import
from optparse import OptionParser

import sfepy
from sfepy.base.conf import ProblemConf, get_standard_keywords
from sfepy.homogenization.homogen_app import HomogenizationApp

usage = """%prog [options] filename_in"""

help = {
    'filename' :
    'basename of output file(s) [default: <basename of input file>]',
}

def main():
    parser = OptionParser(usage=usage, version="%prog " + sfepy.__version__)
    parser.add_option("-o", "", metavar='filename', action="store",
                      dest="output_filename_trunk",
                      default=None, help=help['filename'])

    (options, args) = parser.parse_args()

    if (len(args) == 1):
        filename_in = args[0]
    else:
        parser.print_help(),
        return
<commit_msg>use argparse instead of optparse in homogen.py<commit_after>#!/usr/bin/env python
from __future__ import absolute_import
from argparse import ArgumentParser

import sfepy
from sfepy.base.conf import ProblemConf, get_standard_keywords
from sfepy.homogenization.homogen_app import HomogenizationApp

help = {
    'filename' :
    'basename of output file(s) [default: <basename of input file>]',
}

def main():
    parser = ArgumentParser()
    parser.add_argument("--version", action="version",
                        version="%(prog)s " + sfepy.__version__)
    parser.add_argument("-o", metavar='filename', action="store",
                        dest="output_filename_trunk",
                        default=None, help=help['filename'])
    parser.add_argument('filename_in')
    options = parser.parse_args()

    filename_in = options.filename_in

{'fraction_non_alphanumeric': 0.11740166865315853, 'fraction_numerical': 0.0011918951132300357, 'mean_word_length': 3.453580901856764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7163658', 'n_tokens_mistral': 508, 'n_tokens_neox': 489, 'n_words': 116}