<commit_before>import os
import sys
import traceback

import em_core
import em_deprecated
import em_optparse
from epumgmt.api.exceptions import *
from epumgmt.api import *

def main(argv=None):
    if os.name != 'posix':
        print >>sys.stderr, "Only runs on POSIX systems."
        return 3
        
    parser = em_optparse.parsersetup()

    if argv:
        (opts, args) = parser.parse_args(argv[1:])
    else:
        (opts, args) = parser.parse_args()
       
    epu = EPUMgmtOpts(cmd_opts=opts)
 
    try:
        dbgmsgs = em_deprecated.deprecated_args(opts)
        
        # From here 'down' there is no concept of a commandline program, only
        # 'args' which could be coming from any kind of protocol based request.
        # To make such a thing, construct an opts objects with the expected
        # member names (see the em_args module) and pass it in.
        epumgmt_run(epu, dbgmsgs=dbgmsgs) 

    except InvalidInput, e:
        msg = "Problem with input: %s" % e.msg
        print >>sys.stderr, msg
        return 1

    except InvalidConfig, e:
        msg = "Problem with configuration: %s" % e.msg
        print >>sys.stderr, msg
        return 2

    except IncompatibleEnvironment, e:
        msg = "Problem with environment: %s" % e.msg
        print >>sys.stderr, msg
        return 3

    except UnexpectedError, e:
        msg = "Problem executing: %s" % e.msg
        print >>sys.stderr, msg
        return 4
        
    except KeyboardInterrupt, e:
        print >>sys.stderr, "\nCancelled by ctrl-c/signal"
        return 5
        
    except ProgrammingError,e:
        msg = "*** Developer error ***\n"
        msg += "   If this is a non-modified release, please report all\n"
        msg += "   the following output:\n"<commit_msg>Adding internal flag for enabling remote debugging. Separated the logfile errors and the stdout errors for users that pipe logfiles to stdout.<commit_after>import os
import sys
import traceback

import em_deprecated
import em_optparse
from epumgmt.api.exceptions import *
from epumgmt.api import *

remote_pycharm_debug = 0
try:
    if remote_pycharm_debug:
        from pydev import pydevd
except ImportError, e:
    print >>sys.stderr, "Could not import remote debugging library: %s" % str(e)
    remote_pycharm_debug = 0

def main(argv=None):
    if os.name != 'posix':
        print >>sys.stderr, "Only runs on POSIX systems."
        return 3

    if remote_pycharm_debug:
        pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True)
        
    parser = em_optparse.parsersetup()

    if argv:
        (opts, args) = parser.parse_args(argv[1:])
    else:
        (opts, args) = parser.parse_args()
       
    epu = EPUMgmtOpts(cmd_opts=opts)
 
    try:
        dbgmsgs = em_deprecated.deprecated_args(opts)
        
        # From here 'down' there is no concept of a commandline program, only
        # 'args' which could be coming from any kind of protocol based request.
        # To make such a thing, construct an opts objects with the expected
        # member names (see the em_args module) and pass it in.
        epumgmt_run(epu, dbgmsgs=dbgmsgs) 

    except InvalidInput, e:
        msg = "\nProblem with input: %s" % e.msg
        print >>sys.stderr, msg
        return 1

    except InvalidConfig, e:
        msg = "\nProblem with configuration: %s" % e.msg
        print >>sys.stderr, msg
        return 2

    except IncompatibleEnvironment, e:
        msg = "\nProblem with environment: %s" % e.msg
        print >>sys.stderr, msg
        return 3

    except UnexpectedError, e:
        msg = "\nProblem executing: %s" % e.msg
        print >>sys.stderr, msg
        return 4
        
    except KeyboardInterrupt, e:
        print >>sys.stderr, "\nCancelled by ctrl-c/signal"
        return 5
        
    except ProgrammingError,e:
        msg = "*** Developer error ***\n"
        msg += "   If this is a non-modified release, please report all\n"
        msg += "   the following output:\n"
{'fraction_non_alphanumeric': 0.08960039712087367, 'fraction_numerical': 0.0052122114668652275, 'mean_word_length': 2.338856669428335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1442092', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1208, 'n_words': 410}