diff options
| author | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-03-19 17:28:46 -0500 |
|---|---|---|
| committer | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-03-19 17:28:46 -0500 |
| commit | 38df6facfecb16cc24f829770aff77d24050f7f4 (patch) | |
| tree | f9630c946cc1ef8b600bdfc7b1dea97dc39b115f /utils | |
| parent | 24ab29995d7aa30162d8d17fd2557bf28c5ea6e0 (diff) | |
| download | GolemFlavor-38df6facfecb16cc24f829770aff77d24050f7f4.tar.gz GolemFlavor-38df6facfecb16cc24f829770aff77d24050f7f4.zip | |
update submitter script
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/misc.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/utils/misc.py b/utils/misc.py index c54d25c..2ff0664 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -11,9 +11,12 @@ from __future__ import absolute_import, division import os import errno -from collections import Sequence import multiprocessing +import argparse +from collections import Sequence +from operator import attrgetter + import numpy as np from utils.enums import Likelihood, ParamTag @@ -152,6 +155,13 @@ class ParamSet(Sequence): if obj.tag is tag]) +class SortingHelpFormatter(argparse.HelpFormatter): + """Sort argparse help options alphabetically.""" + def add_arguments(self, actions): + actions = sorted(actions, key=attrgetter('option_strings')) + super(SortingHelpFormatter, self).add_arguments(actions) + + def gen_outfile_name(args): """Generate a name for the output file based on the input args. @@ -238,7 +248,7 @@ def print_args(args): """ arg_vars = vars(args) - for key in arg_vars.iterkeys(): + for key in sorted(arg_vars): print '== {0:<25} = {1}'.format(key, arg_vars[key]) |
