From 529378a1e3b3dde43531ceb2ed9147d03981d050 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 25 Jun 2016 19:40:50 +0300 Subject: code style --- plot.bat | 12 ++++++------ plot.py | 7 +++++-- test.py | 7 +++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/plot.bat b/plot.bat index f046087..c215b7e 100644 --- a/plot.bat +++ b/plot.bat @@ -12,19 +12,19 @@ @set algorithm=%1 @if not E%2 == E ( - set iterations=%2 + set iterations=%2 ) else ( - set iterations=%DEFAULT_ITERATIONS% + set iterations=%DEFAULT_ITERATIONS% ) @if not E%3 == E ( - set min=%3 + set min=%3 ) else ( - set min=%DEFAULT_MIN% + set min=%DEFAULT_MIN% ) @if not E%4 == E ( - set max=%4 + set max=%4 ) else ( - set max=%DEFAULT_MAX% + set max=%DEFAULT_MAX% ) plot.py "%algorithm%" --min "%min%" --max "%max%" ^ diff --git a/plot.py b/plot.py index 35fd6ed..3f6b905 100644 --- a/plot.py +++ b/plot.py @@ -63,11 +63,14 @@ def _format_available_algorithms(): def _format_description(): return _format_available_algorithms() -def _parse_args(args=sys.argv): - parser = argparse.ArgumentParser( +def _create_argument_parser(): + return argparse.ArgumentParser( description=_format_description(), formatter_class=argparse.RawDescriptionHelpFormatter) +def _parse_args(args=sys.argv): + parser = _create_argument_parser() + parser.add_argument('algorithm', metavar='CODENAME', choices=registry.get_codenames(), help='algorithm codename') diff --git a/test.py b/test.py index a9bf401..4c96ead 100644 --- a/test.py +++ b/test.py @@ -47,11 +47,14 @@ def _format_available_algorithms(): def _format_description(): return _format_available_algorithms() -def _parse_args(args=sys.argv): - parser = argparse.ArgumentParser( +def _create_argument_parser(): + return argparse.ArgumentParser( description=_format_description(), formatter_class=argparse.RawDescriptionHelpFormatter) +def _parse_args(args=sys.argv): + parser = _create_argument_parser() + parser.add_argument('algorithm', metavar='CODENAME', choices=registry.get_codenames(), help='algorithm codename') -- cgit v1.2.3