From 111a517b97b7ce263954041f7c3bb7c4668c6cb3 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 16 Sep 2018 12:13:08 -0700 Subject: [PATCH] closes #298 - unused non-python3 file --- gooey/python_bindings/docopt_to_json.py | 76 ------------------------- 1 file changed, 76 deletions(-) delete mode 100644 gooey/python_bindings/docopt_to_json.py diff --git a/gooey/python_bindings/docopt_to_json.py b/gooey/python_bindings/docopt_to_json.py deleted file mode 100644 index 93868d3..0000000 --- a/gooey/python_bindings/docopt_to_json.py +++ /dev/null @@ -1,76 +0,0 @@ - -""" -Naval Fate. - -Usage: - naval_fate.py ship new ... - naval_fate.py ship move [--speed=] - naval_fate.py ship shoot - naval_fate.py mine (set|remove) [--moored|--drifting] - naval_fate.py -h | --help - naval_fate.py --version - -Options: - -h --help Show this screen. - --version Show version. - --speed= Speed in knots [default: 10]. - --moored Moored (anchored) mine. - --drifting Drifting mine. - -""" - -# Standard -# choice -# counter -# flag -# mutually_exclusive -# -# types? - - -import re -from docopt import docopt, Option, Argument - - -class MyOption(Option): - def __init__(self, *args, **kwargs): - self.description = kwargs.pop('description', None) - super(MyOption, self).__init__(*args, **kwargs) - - - @classmethod - def parse(class_, option_description): - short, long, argcount, value = None, None, 0, False - options, _, description = option_description.strip().partition(' ') - options = options.replace(',', ' ').replace('=', ' ') - for s in options.split(): - if s.startswith('--'): - long = s - elif s.startswith('-'): - short = s - else: - argcount = 1 - if argcount: - matched = re.findall(r'\[default: (.*)\]', description, flags=re.I) - value = matched[0] if matched else None - return class_(short, long, argcount, value, description=description.strip()) - - def __repr__(self): - return 'Option(%r, %r, %r, %r, %r)' % (self.short, self.long, - self.argcount, self.value, self.description) - - -if __name__ == '__main__': - import sys - a = docopt(__doc__) - # import re - # doc = __doc__ - # split = re.split('\n *(<\S+?>|-\S+?)', doc)[1:] - # split = [s1 + s2 for s1, s2 in zip(split[::2], split[1::2])] - # options = [MyOption.parse(s) for s in split if s.startswith('-')] - # arguments = [Argument.parse(s) for s in split if s.startswith('<')] - # #return options, arguments - # print arguments - # print options - print a - a = 10