-
Notifications
You must be signed in to change notification settings - Fork 0
/
systems-unsetdefault.py
executable file
·40 lines (30 loc) · 1.28 KB
/
systems-unsetdefault.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import argparse
import json
import os.path
import vdjpy
import sys
if __name__ == '__main__':
# arguments
parser = argparse.ArgumentParser(description = 'Remove a system\'s status as the default system of that type for the user.')
parser.add_argument('-s', '--systemID', dest = 'systemID', nargs = '?', help = 'system ID')
parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
args = parser.parse_args()
# make agave object and kwargs
my_agave = vdjpy.make_vdj_agave(args.accesstoken)
kwargs = {}
# -f
if args.systemID is None:
args.systemID = vdjpy.prompt_user('system ID')
kwargs['systemId'] = args.systemID
# build body
kwargs['body'] = "{\n\t\"action\": \"UNSETDEFAULT\"\n}"
# set default system
unset_default = my_agave.systems.manage(**kwargs)
# if -v
if args.verbose is True:
print json.dumps(unset_default, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
# if no -v
else:
print 'Successfully removed system', args.systemID, 'from default', unset_default['type'], 'system'