You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

2 years ago
2 years ago
  1. import unittest
  2. from argparse import ArgumentParser
  3. from functools import wraps
  4. from gooey.python_bindings.types import TimingOptions
  5. # TODO:
  6. # def decor(f=None, *gargs, **gkwargs):
  7. # @wraps(f)
  8. # def inner(*args, **kwargs):
  9. # print('hello from decorator', gargs, gkwargs)
  10. # # choose handler
  11. # # monkey patch parser
  12. #
  13. # return f(*args, **kwargs)
  14. #
  15. # def inner2(func):
  16. # return decor(func, *gargs, **gkwargs)
  17. #
  18. # return inner if callable(f) else inner2
  19. #
  20. #
  21. # def handle_success(params):
  22. # def parse_args(self: ArgumentParser, args=None, namespace=None):
  23. # return self._original_parse_args()
  24. # return parse_args
  25. #
  26. #
  27. # # @decor
  28. # def main(*args, **kwargs):
  29. # """Hellow world!!!!!"""
  30. # print('sup from main', args, kwargs)
  31. #
  32. # # ArgumentParser._original_parse_args = ArgumentParser.parse_args
  33. # # ArgumentParser.parse_args = handle_success(ArgumentParser.parse_args)
  34. #
  35. # parser = ArgumentParser()
  36. # parser.add_argument('-f', '--foo', help='is foo')
  37. # subs = parser.add_subparsers()
  38. # sp = subs.add_parser('hh')
  39. # sp.add_argument('-f', '--foo', help='sp.foo')
  40. # print(parser.parse_args(['hh', '-f', 'asdf']))
  41. #
  42. # print(TimingOptions(show_time_remaining=True, hide_time_remaining_on_complete=True).hide_time_remaining_on_complete)
  43. #
  44. #
  45. #
  46. #
  47. # class Testie(unittest.TestCase):
  48. #
  49. # def test_thing(self, **kwargs):
  50. # print(main(1, 2))
  51. # print(help(main))