aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/scripts/plot.py
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms/scripts/plot.py')
-rwxr-xr-xalgorithms/scripts/plot.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/algorithms/scripts/plot.py b/algorithms/scripts/plot.py
index 5eb8b16..25a87f7 100755
--- a/algorithms/scripts/plot.py
+++ b/algorithms/scripts/plot.py
@@ -40,9 +40,9 @@ def _parse_non_negative_integer(s):
try:
n = int(s)
except ValueError:
- raise argparse.ArgumentTypeError('must be a non-negative integer: ' + str(s))
+ raise argparse.ArgumentTypeError("must be a non-negative integer: " + str(s))
if n < 0:
- raise argparse.ArgumentTypeError('must be a non-negative integer')
+ raise argparse.ArgumentTypeError("must be a non-negative integer")
return n
@@ -50,9 +50,9 @@ def _parse_positive_integer(s):
try:
n = int(s)
except ValueError:
- raise argparse.ArgumentTypeError('must be a positive integer: ' + str(s))
+ raise argparse.ArgumentTypeError("must be a positive integer: " + str(s))
if n < 1:
- raise argparse.ArgumentTypeError('must be a positive integer')
+ raise argparse.ArgumentTypeError("must be a positive integer")
return n
@@ -60,16 +60,16 @@ def _parse_input_kind(s):
try:
return InputKind(s)
except ValueError:
- raise argparse.ArgumentTypeError('invalid input kind: ' + str(s))
+ raise argparse.ArgumentTypeError("invalid input kind: " + str(s))
def _format_algorithm(codename):
- return '* {}: {}'.format(codename, registry.get(codename).display_name)
+ return "* {}: {}".format(codename, registry.get(codename).display_name)
def _format_available_algorithms():
- descr = 'available algorithms (in the CODENAME: DISPLAY_NAME format):\n'
- return descr + '\n'.join(map(_format_algorithm, sorted(registry.get_codenames())))
+ descr = "available algorithms (in the CODENAME: DISPLAY_NAME format):\n"
+ return descr + "\n".join(map(_format_algorithm, sorted(registry.get_codenames())))
def _format_description():
@@ -89,48 +89,48 @@ def _parse_args(args=None):
parser = _create_argument_parser()
parser.add_argument(
- 'algorithm',
- metavar='CODENAME',
+ "algorithm",
+ metavar="CODENAME",
choices=registry.get_codenames(),
- help='algorithm codename',
+ help="algorithm codename",
)
parser.add_argument(
- '--iterations',
- '-r',
- metavar='N',
+ "--iterations",
+ "-r",
+ metavar="N",
type=_parse_positive_integer,
default=_DEFAULT_ITERATIONS,
- help='set number of algorithm iterations',
+ help="set number of algorithm iterations",
)
parser.add_argument(
- '--input',
- '-i',
- dest='input_kind',
+ "--input",
+ "-i",
+ dest="input_kind",
choices=InputKind,
type=_parse_input_kind,
default=_DEFAULT_INPUT_KIND,
- help='specify input kind',
+ help="specify input kind",
)
parser.add_argument(
- '--min',
- '-a',
- metavar='N',
- dest='min_len',
+ "--min",
+ "-a",
+ metavar="N",
+ dest="min_len",
type=_parse_non_negative_integer,
default=_DEFAULT_MIN_LENGTH,
- help='set min input length',
+ help="set min input length",
)
parser.add_argument(
- '--max',
- '-b',
- metavar='N',
- dest='max_len',
+ "--max",
+ "-b",
+ metavar="N",
+ dest="max_len",
type=_parse_non_negative_integer,
default=_DEFAULT_MAX_LENGTH,
- help='set max input length',
+ help="set max input length",
)
parser.add_argument(
- '--output', '-o', metavar='PATH', dest='output_path', help='set plot file path'
+ "--output", "-o", metavar="PATH", dest="output_path", help="set plot file path"
)
return parser.parse_args(args)
@@ -140,5 +140,5 @@ def main(args=None):
plot_algorithm(**vars(_parse_args(args)))
-if __name__ == '__main__':
+if __name__ == "__main__":
main()