Skip to content

Commit 0ec404f

Browse files
author
Troy Melhase
committed
Better function names.
1 parent 9dd6dd4 commit 0ec404f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

bin/j2py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ def logLevel(value):
3737
return lvl
3838

3939

40-
def profileMain(options):
40+
def configFromDir(inname, dirname):
41+
""" Returns a file name from the given config directory. """
42+
name = path.join(dirname, path.basename(path.splitext(inname)[0]))
43+
return '%s.py' % path.abspath(name)
44+
45+
46+
def runMain(options):
4147
""" Runs our main function with profiling if indicated by options. """
4248
if options.profile:
4349
import cProfile, pstats
4450
prof = cProfile.Profile()
45-
prof.runcall(main, options)
51+
prof.runcall(runTransform, options)
4652
stats = pstats.Stats(prof, stream=sys.stderr)
4753
stats.strip_dirs().sort_stats('cumulative')
4854
stats.print_stats().print_callers()
4955
return 0
5056
else:
51-
return main(options)
52-
53-
54-
def configFromDir(inname, dirname):
55-
""" Returns a file name from the given config directory. """
56-
name = path.join(dirname, path.basename(path.splitext(inname)[0]))
57-
return '%s.py' % path.abspath(name)
57+
return runTransform(options)
5858

5959

60-
def main(options):
60+
def runTransform(options):
6161
""" Compile the indicated java source with the given options. """
6262
timed = defaultdict(time)
6363
timed['overall']
@@ -168,7 +168,7 @@ def configColors(nocolor):
168168
escapes.clear()
169169

170170

171-
def config(argv):
171+
def configScript(argv):
172172
""" Return an options object from the given argument sequence. """
173173
parser = ArgumentParser(
174174
description='Translate Java source code to Python.',
@@ -230,4 +230,4 @@ def config(argv):
230230

231231

232232
if __name__ == '__main__':
233-
sys.exit(profileMain(config(sys.argv[1:])))
233+
sys.exit(runMain(configScript(sys.argv[1:])))

0 commit comments

Comments
 (0)