jirate 0.8.14__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jirate/__init__.py +3 -0
- jirate/args.py +81 -0
- jirate/board.py +623 -0
- jirate/cli.py +709 -0
- jirate/config.py +67 -0
- jirate/decor.py +531 -0
- jirate/jboard.py +1176 -0
- jirate/jira_cli.py +1702 -0
- jirate/jira_custom.py +82 -0
- jirate/jira_fields.py +635 -0
- jirate/jira_input.py +217 -0
- jirate/localstate.py +91 -0
- jirate/rqcache.py +193 -0
- jirate/schemas/issue.yaml +28 -0
- jirate/schemas/subtask.yaml +18 -0
- jirate/schemas/template.yaml +18 -0
- jirate/template_vars.py +252 -0
- jirate/tests/__init__.py +980 -0
- jirate/tests/templates/bad-template.yaml +28 -0
- jirate/tests/templates/good-template.yaml +29 -0
- jirate/tests/test_config.py +39 -0
- jirate/tests/test_decor.py +52 -0
- jirate/tests/test_fields.py +72 -0
- jirate/tests/test_input.py +203 -0
- jirate/tests/test_jira_cli.py +272 -0
- jirate/tests/test_jira_custom.py +59 -0
- jirate/tests/test_jirate.py +133 -0
- jirate/tests/test_render.py +193 -0
- jirate/tests/test_rqcache.py +132 -0
- jirate/tests/test_schemas.py +22 -0
- jirate/tests/test_template_vars.py +85 -0
- jirate-0.8.14.data/data/LICENSE.txt +25 -0
- jirate-0.8.14.dist-info/METADATA +221 -0
- jirate-0.8.14.dist-info/RECORD +37 -0
- jirate-0.8.14.dist-info/WHEEL +5 -0
- jirate-0.8.14.dist-info/entry_points.txt +3 -0
- jirate-0.8.14.dist-info/licenses/LICENSE.txt +25 -0
jirate/__init__.py
ADDED
jirate/args.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
# Wrapper to add handlers to subparsers
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ComplicatedArgs(object):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self._parser = argparse.ArgumentParser()
|
|
10
|
+
self._commands = {}
|
|
11
|
+
self._handlers = {}
|
|
12
|
+
self._subparsers = None
|
|
13
|
+
self._parsed_ns = None
|
|
14
|
+
self._args = {} # Pasted in to namespaces before calling handlers
|
|
15
|
+
|
|
16
|
+
def parser(self):
|
|
17
|
+
return self._parser
|
|
18
|
+
|
|
19
|
+
def add_arg(self, key, value):
|
|
20
|
+
self._args[key] = value
|
|
21
|
+
|
|
22
|
+
def add_argument(self, *args, **kwargs):
|
|
23
|
+
self._parser.add_argument(*args, **kwargs)
|
|
24
|
+
|
|
25
|
+
def command(self, cmd, help=None, handler=None):
|
|
26
|
+
if cmd in self._commands:
|
|
27
|
+
raise ValueError('Command already specified:' + str(cmd))
|
|
28
|
+
|
|
29
|
+
if self._subparsers is None:
|
|
30
|
+
self._subparsers = self._parser.add_subparsers(help='Commands (add -h for help)', dest='command')
|
|
31
|
+
subparser = self._subparsers.add_parser(cmd, help=help)
|
|
32
|
+
self._commands[cmd] = subparser
|
|
33
|
+
if handler is not None:
|
|
34
|
+
self.register_handler(cmd, handler)
|
|
35
|
+
return subparser
|
|
36
|
+
|
|
37
|
+
def register_handler(self, cmd, handler):
|
|
38
|
+
if cmd not in self._commands:
|
|
39
|
+
raise ValueError('Undefined command:', str(cmd))
|
|
40
|
+
self._handlers[cmd] = handler
|
|
41
|
+
|
|
42
|
+
def delete_handler(self, cmd, handler):
|
|
43
|
+
if cmd not in self._commands:
|
|
44
|
+
raise ValueError('Undefined command:', str(cmd))
|
|
45
|
+
if cmd in self._handlers:
|
|
46
|
+
del self.handlers[cmd]
|
|
47
|
+
|
|
48
|
+
def parse_args(self, **kwargs):
|
|
49
|
+
return self._parser.parse_args(**kwargs)
|
|
50
|
+
|
|
51
|
+
# Call our callouts with the namespace mapping we built
|
|
52
|
+
def finalize(self, ns, ret=None):
|
|
53
|
+
cmd = None
|
|
54
|
+
try:
|
|
55
|
+
if ns.command:
|
|
56
|
+
cmd = ns.command
|
|
57
|
+
except AttributeError:
|
|
58
|
+
pass
|
|
59
|
+
for key in self._args:
|
|
60
|
+
setattr(ns, key, self._args[key])
|
|
61
|
+
self._parsed_ns = ns
|
|
62
|
+
if cmd and cmd in self._handlers:
|
|
63
|
+
return self._handlers[cmd](ns)
|
|
64
|
+
# Command not found
|
|
65
|
+
return ret
|
|
66
|
+
|
|
67
|
+
# Store this so we can return our handlers' return values instead of
|
|
68
|
+
# our own.
|
|
69
|
+
def namespace(self):
|
|
70
|
+
return self._parsed_ns
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# For calling cmdline functions w/o using
|
|
74
|
+
# argparse
|
|
75
|
+
class GenericArgs(dict):
|
|
76
|
+
def __getattr__(self, name):
|
|
77
|
+
if (name in self):
|
|
78
|
+
return dict.__getitem__(self, name)
|
|
79
|
+
return None
|
|
80
|
+
__setattr__ = dict.__setitem__
|
|
81
|
+
__delattr__ = dict.__delitem__
|