Mercurial > repos > gga > apollo_feat_from_gff3
annotate webapollo.py @ 19:7421b9db6240 draft
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
| author | gga | 
|---|---|
| date | Fri, 10 Dec 2021 09:46:59 +0000 | 
| parents | 86b18242f380 | 
| children | 0cf60135f4dd | 
| rev | line source | 
|---|---|
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
1 from __future__ import print_function | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
2 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
3 import argparse | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
4 import collections | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
5 import json | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
6 import logging | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
7 import os | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
8 import time | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
9 from abc import abstractmethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
10 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
11 import requests | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
12 | 
| 
5
 
6f2dac11110e
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 70fbb41d4c6b0a08a7bed4849a5ae7c865e1ab1e
 
gga 
parents: 
4 
diff
changeset
 | 
13 from six.moves.builtins import next | 
| 
 
6f2dac11110e
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 70fbb41d4c6b0a08a7bed4849a5ae7c865e1ab1e
 
gga 
parents: 
4 
diff
changeset
 | 
14 from six.moves.builtins import object | 
| 
 
6f2dac11110e
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 70fbb41d4c6b0a08a7bed4849a5ae7c865e1ab1e
 
gga 
parents: 
4 
diff
changeset
 | 
15 | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
16 import yaml | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
17 | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
18 logging.getLogger("requests").setLevel(logging.CRITICAL) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
19 log = logging.getLogger() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
20 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
21 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
22 ############################################# | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
23 # BEGIN IMPORT OF CACHING LIBRARY # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
24 ############################################# | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
25 # This code is licensed under the MIT # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
26 # License and is a copy of code publicly # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
27 # available in rev. # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
28 # e27332bc82f4e327aedaec17c9b656ae719322ed # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
29 # of https://github.com/tkem/cachetools/ # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
30 ############################################# | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
31 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
32 class DefaultMapping(collections.MutableMapping): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
33 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
34 __slots__ = () | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
35 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
36 @abstractmethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
37 def __contains__(self, key): # pragma: nocover | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
38 return False | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
39 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
40 @abstractmethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
41 def __getitem__(self, key): # pragma: nocover | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
42 if hasattr(self.__class__, '__missing__'): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
43 return self.__class__.__missing__(self, key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
44 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
45 raise KeyError(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
46 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
47 def get(self, key, default=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
48 if key in self: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
49 return self[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
50 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
51 return default | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
52 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
53 __marker = object() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
54 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
55 def pop(self, key, default=__marker): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
56 if key in self: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
57 value = self[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
58 del self[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
59 elif default is self.__marker: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
60 raise KeyError(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
61 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
62 value = default | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
63 return value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
64 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
65 def setdefault(self, key, default=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
66 if key in self: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
67 value = self[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
68 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
69 self[key] = value = default | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
70 return value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
71 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
72 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
73 DefaultMapping.register(dict) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
74 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
75 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
76 class _DefaultSize(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
77 def __getitem__(self, _): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
78 return 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
79 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
80 def __setitem__(self, _, value): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
81 assert value == 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
82 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
83 def pop(self, _): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
84 return 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
85 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
86 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
87 class Cache(DefaultMapping): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
88 """Mutable mapping to serve as a simple cache or cache base class.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
89 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
90 __size = _DefaultSize() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
91 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
92 def __init__(self, maxsize, missing=None, getsizeof=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
93 if missing: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
94 self.__missing = missing | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
95 if getsizeof: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
96 self.__getsizeof = getsizeof | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
97 self.__size = dict() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
98 self.__data = dict() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
99 self.__currsize = 0 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
100 self.__maxsize = maxsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
101 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
102 def __repr__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
103 return '%s(%r, maxsize=%r, currsize=%r)' % ( | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
104 self.__class__.__name__, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
105 list(self.__data.items()), | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
106 self.__maxsize, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
107 self.__currsize, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
108 ) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
109 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
110 def __getitem__(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
111 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
112 return self.__data[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
113 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
114 return self.__missing__(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
115 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
116 def __setitem__(self, key, value): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
117 maxsize = self.__maxsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
118 size = self.getsizeof(value) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
119 if size > maxsize: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
120 raise ValueError('value too large') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
121 if key not in self.__data or self.__size[key] < size: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
122 while self.__currsize + size > maxsize: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
123 self.popitem() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
124 if key in self.__data: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
125 diffsize = size - self.__size[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
126 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
127 diffsize = size | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
128 self.__data[key] = value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
129 self.__size[key] = size | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
130 self.__currsize += diffsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
131 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
132 def __delitem__(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
133 size = self.__size.pop(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
134 del self.__data[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
135 self.__currsize -= size | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
136 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
137 def __contains__(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
138 return key in self.__data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
139 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
140 def __missing__(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
141 value = self.__missing(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
142 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
143 self.__setitem__(key, value) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
144 except ValueError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
145 pass # value too large | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
146 return value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
147 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
148 def __iter__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
149 return iter(self.__data) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
150 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
151 def __len__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
152 return len(self.__data) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
153 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
154 @staticmethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
155 def __getsizeof(value): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
156 return 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
157 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
158 @staticmethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
159 def __missing(key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
160 raise KeyError(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
161 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
162 @property | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
163 def maxsize(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
164 """The maximum size of the cache.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
165 return self.__maxsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
166 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
167 @property | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
168 def currsize(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
169 """The current size of the cache.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
170 return self.__currsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
171 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
172 def getsizeof(self, value): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
173 """Return the size of a cache element's value.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
174 return self.__getsizeof(value) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
175 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
176 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
177 class _Link(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
178 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
179 __slots__ = ('key', 'expire', 'next', 'prev') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
180 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
181 def __init__(self, key=None, expire=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
182 self.key = key | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
183 self.expire = expire | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
184 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
185 def __reduce__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
186 return _Link, (self.key, self.expire) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
187 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
188 def unlink(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
189 next = self.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
190 prev = self.prev | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
191 prev.next = next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
192 next.prev = prev | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
193 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
194 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
195 class _Timer(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
196 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
197 def __init__(self, timer): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
198 self.__timer = timer | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
199 self.__nesting = 0 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
200 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
201 def __call__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
202 if self.__nesting == 0: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
203 return self.__timer() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
204 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
205 return self.__time | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
206 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
207 def __enter__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
208 if self.__nesting == 0: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
209 self.__time = time = self.__timer() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
210 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
211 time = self.__time | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
212 self.__nesting += 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
213 return time | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
214 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
215 def __exit__(self, *exc): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
216 self.__nesting -= 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
217 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
218 def __reduce__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
219 return _Timer, (self.__timer,) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
220 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
221 def __getattr__(self, name): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
222 return getattr(self.__timer, name) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
223 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
224 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
225 class TTLCache(Cache): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
226 """LRU Cache implementation with per-item time-to-live (TTL) value.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
227 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
228 def __init__(self, maxsize, ttl, timer=time.time, missing=None, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
229 getsizeof=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
230 Cache.__init__(self, maxsize, missing, getsizeof) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
231 self.__root = root = _Link() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
232 root.prev = root.next = root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
233 self.__links = collections.OrderedDict() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
234 self.__timer = _Timer(timer) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
235 self.__ttl = ttl | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
236 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
237 def __contains__(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
238 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
239 link = self.__links[key] # no reordering | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
240 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
241 return False | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
242 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
243 return not (link.expire < self.__timer()) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
244 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
245 def __getitem__(self, key, cache_getitem=Cache.__getitem__): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
246 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
247 link = self.__getlink(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
248 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
249 expired = False | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
250 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
251 expired = link.expire < self.__timer() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
252 if expired: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
253 return self.__missing__(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
254 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
255 return cache_getitem(self, key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
256 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
257 def __setitem__(self, key, value, cache_setitem=Cache.__setitem__): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
258 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
259 self.expire(time) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
260 cache_setitem(self, key, value) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
261 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
262 link = self.__getlink(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
263 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
264 self.__links[key] = link = _Link(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
265 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
266 link.unlink() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
267 link.expire = time + self.__ttl | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
268 link.next = root = self.__root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
269 link.prev = prev = root.prev | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
270 prev.next = root.prev = link | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
271 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
272 def __delitem__(self, key, cache_delitem=Cache.__delitem__): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
273 cache_delitem(self, key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
274 link = self.__links.pop(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
275 link.unlink() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
276 if link.expire < self.__timer(): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
277 raise KeyError(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
278 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
279 def __iter__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
280 root = self.__root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
281 curr = root.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
282 while curr is not root: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
283 # "freeze" time for iterator access | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
284 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
285 if not (curr.expire < time): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
286 yield curr.key | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
287 curr = curr.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
288 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
289 def __len__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
290 root = self.__root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
291 curr = root.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
292 time = self.__timer() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
293 count = len(self.__links) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
294 while curr is not root and curr.expire < time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
295 count -= 1 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
296 curr = curr.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
297 return count | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
298 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
299 def __setstate__(self, state): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
300 self.__dict__.update(state) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
301 root = self.__root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
302 root.prev = root.next = root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
303 for link in sorted(self.__links.values(), key=lambda obj: obj.expire): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
304 link.next = root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
305 link.prev = prev = root.prev | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
306 prev.next = root.prev = link | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
307 self.expire(self.__timer()) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
308 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
309 def __repr__(self, cache_repr=Cache.__repr__): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
310 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
311 self.expire(time) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
312 return cache_repr(self) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
313 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
314 @property | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
315 def currsize(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
316 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
317 self.expire(time) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
318 return super(TTLCache, self).currsize | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
319 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
320 @property | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
321 def timer(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
322 """The timer function used by the cache.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
323 return self.__timer | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
324 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
325 @property | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
326 def ttl(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
327 """The time-to-live value of the cache's items.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
328 return self.__ttl | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
329 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
330 def expire(self, time=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
331 """Remove expired items from the cache.""" | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
332 if time is None: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
333 time = self.__timer() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
334 root = self.__root | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
335 curr = root.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
336 links = self.__links | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
337 cache_delitem = Cache.__delitem__ | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
338 while curr is not root and curr.expire < time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
339 cache_delitem(self, curr.key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
340 del links[curr.key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
341 next = curr.next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
342 curr.unlink() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
343 curr = next | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
344 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
345 def clear(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
346 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
347 self.expire(time) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
348 Cache.clear(self) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
349 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
350 def get(self, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
351 with self.__timer: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
352 return Cache.get(self, *args, **kwargs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
353 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
354 def pop(self, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
355 with self.__timer: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
356 return Cache.pop(self, *args, **kwargs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
357 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
358 def setdefault(self, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
359 with self.__timer: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
360 return Cache.setdefault(self, *args, **kwargs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
361 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
362 def popitem(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
363 """Remove and return the `(key, value)` pair least recently used that | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
364 has not already expired. | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
365 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
366 """ | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
367 with self.__timer as time: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
368 self.expire(time) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
369 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
370 key = next(iter(self.__links)) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
371 except StopIteration: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
372 raise KeyError('%s is empty' % self.__class__.__name__) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
373 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
374 return (key, self.pop(key)) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
375 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
376 if hasattr(collections.OrderedDict, 'move_to_end'): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
377 def __getlink(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
378 value = self.__links[key] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
379 self.__links.move_to_end(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
380 return value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
381 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
382 def __getlink(self, key): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
383 value = self.__links.pop(key) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
384 self.__links[key] = value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
385 return value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
386 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
387 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
388 ############################################# | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
389 # END IMPORT OF CACHING LIBRARY # | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
390 ############################################# | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
391 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
392 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
393 cache = TTLCache( | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
394 100, # Up to 100 items | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
395 5 * 60 # 5 minute cache life | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
396 ) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
397 userCache = TTLCache( | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
398 2, # Up to 2 items | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
399 60 # 1 minute cache life | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
400 ) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
401 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
402 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
403 class UnknownUserException(Exception): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
404 pass | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
405 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
406 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
407 def WAAuth(parser): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
408 parser.add_argument('apollo', help='Complete Apollo URL') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
409 parser.add_argument('username', help='WA Username') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
410 parser.add_argument('password', help='WA Password') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
411 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
412 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
413 def OrgOrGuess(parser): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
414 parser.add_argument('--org_json', type=argparse.FileType("r"), help='Apollo JSON output, source for common name') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
415 parser.add_argument('--org_raw', help='Common Name') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
416 parser.add_argument('--org_id', help='Organism ID') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
417 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
418 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
419 def CnOrGuess(parser): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
420 OrgOrGuess(parser) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
421 parser.add_argument('--seq_fasta', type=argparse.FileType("r"), help='Fasta file, IDs used as sequence sources') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
422 parser.add_argument('--seq_raw', nargs='*', help='Sequence Names') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
423 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
424 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
425 def AssertUser(user_list): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
426 if len(user_list) == 0: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
427 raise UnknownUserException() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
428 elif len(user_list) == 1: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
429 return user_list[0] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
430 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
431 raise Exception("Too many users!") | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
432 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
433 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
434 class WebApolloInstance(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
435 | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
436 def __init__(self): | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
437 | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
438 if 'ARROW_GLOBAL_CONFIG_PATH' in os.environ: | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
439 | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
440 with open(os.environ['ARROW_GLOBAL_CONFIG_PATH'], 'r') as config: | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
441 conf = yaml.safe_load(config) | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
442 try: | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
443 instance_name = conf['__default'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
444 except KeyError: | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
445 raise Exception("Unknown Apollo instance and no __default provided") | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
446 self.apollo_url = conf[instance_name]['url'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
447 self.username = conf[instance_name]['username'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
448 self.password = conf[instance_name]['password'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
449 else: | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
450 self.apollo_url = os.environ['GALAXY_WEBAPOLLO_URL'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
451 self.username = os.environ['GALAXY_WEBAPOLLO_USER'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
452 self.password = os.environ['GALAXY_WEBAPOLLO_PASSWORD'] | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
453 | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
454 self.groups = GroupsClient(self) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
455 self.organisms = OrganismsClient(self) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
456 self.users = UsersClient(self) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
457 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
458 def __str__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
459 return '<WebApolloInstance at %s>' % self.apollo_url | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
460 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
461 def requireUser(self, email): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
462 cacheKey = 'user-list' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
463 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
464 # Get the cached value | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
465 data = userCache[cacheKey] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
466 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
467 # If we hit a key error above, indicating that | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
468 # we couldn't find the key, we'll simply re-request | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
469 # the data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
470 data = self.users.loadUsers() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
471 userCache[cacheKey] = data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
472 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
473 return AssertUser([x for x in data if x.username == email]) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
474 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
475 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
476 class GroupObj(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
477 def __init__(self, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
478 self.name = kwargs['name'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
479 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
480 if 'id' in kwargs: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
481 self.groupId = kwargs['id'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
482 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
483 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
484 class UserObj(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
485 ROLE_USER = 'USER' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
486 ROLE_ADMIN = 'ADMIN' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
487 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
488 def __init__(self, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
489 # Generally expect 'userId', 'firstName', 'lastName', 'username' (email) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
490 for attr in kwargs.keys(): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
491 setattr(self, attr, kwargs[attr]) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
492 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
493 if 'groups' in kwargs: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
494 groups = [] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
495 for groupData in kwargs['groups']: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
496 groups.append(GroupObj(**groupData)) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
497 self.groups = groups | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
498 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
499 self.__props = kwargs.keys() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
500 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
501 def __str__(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
502 return '<User %s: %s %s <%s>>' % (self.userId, self.firstName, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
503 self.lastName, self.username) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
504 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
505 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
506 class Client(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
507 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
508 def __init__(self, webapolloinstance, **requestArgs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
509 self._wa = webapolloinstance | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
510 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
511 self.__verify = requestArgs.get('verify', True) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
512 self._requestArgs = requestArgs | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
513 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
514 if 'verify' in self._requestArgs: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
515 del self._requestArgs['verify'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
516 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
517 def request(self, clientMethod, data, post_params={}, isJson=True): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
518 url = self._wa.apollo_url + self.CLIENT_BASE + clientMethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
519 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
520 headers = { | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
521 'Content-Type': 'application/json' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
522 } | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
523 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
524 data.update({ | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
525 'username': self._wa.username, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
526 'password': self._wa.password, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
527 }) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
528 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
529 r = requests.post(url, data=json.dumps(data), headers=headers, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
530 verify=self.__verify, params=post_params, allow_redirects=False, **self._requestArgs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
531 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
532 if r.status_code == 200 or r.status_code == 302: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
533 if isJson: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
534 d = r.json() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
535 if 'username' in d: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
536 del d['username'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
537 if 'password' in d: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
538 del d['password'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
539 return d | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
540 else: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
541 return r.text | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
542 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
543 # @see self.body for HTTP response body | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
544 raise Exception("Unexpected response from apollo %s: %s" % | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
545 (r.status_code, r.text)) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
546 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
547 def get(self, clientMethod, get_params): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
548 url = self._wa.apollo_url + self.CLIENT_BASE + clientMethod | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
549 headers = {} | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
550 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
551 r = requests.get(url, headers=headers, verify=self.__verify, | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
552 params=get_params, **self._requestArgs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
553 if r.status_code == 200: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
554 d = r.json() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
555 if 'username' in d: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
556 del d['username'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
557 if 'password' in d: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
558 del d['password'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
559 return d | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
560 # @see self.body for HTTP response body | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
561 raise Exception("Unexpected response from apollo %s: %s" % | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
562 (r.status_code, r.text)) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
563 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
564 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
565 class GroupsClient(Client): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
566 CLIENT_BASE = '/group/' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
567 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
568 def loadGroups(self, group=None): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
569 res = self.request('loadGroups', {}) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
570 data = [GroupObj(**x) for x in res] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
571 if group is not None: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
572 data = [x for x in data if x.name == group] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
573 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
574 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
575 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
576 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
577 class OrganismsClient(Client): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
578 CLIENT_BASE = '/organism/' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
579 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
580 def findAllOrganisms(self): | 
| 
6
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
581 orgs = self.request('findAllOrganisms', {}) | 
| 
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
582 if not isinstance(orgs, (list,)): | 
| 
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
583 orgs = [] | 
| 
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
584 return orgs | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
585 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
586 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
587 class UsersClient(Client): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
588 CLIENT_BASE = '/user/' | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
589 | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
590 def loadUsers(self): | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
591 res = self.request('loadUsers', {}) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
592 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
593 data = [UserObj(**x) for x in res] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
594 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
595 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
596 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
597 | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
598 def handle_credentials(user): | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
599 if hasattr(user, 'new_password'): | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
600 f = open("Apollo_credentials.txt", "w") | 
| 
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
601 f.write('Username:\t%s\nPassword:\t%s' % (user.username, user.new_password)) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
602 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
603 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
604 def accessible_organisms(user, orgs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
605 permissionMap = { | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
606 x['organism']: x['permissions'] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
607 for x in user.organismPermissions | 
| 
7
 
75b85e4d7c62
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit d9f27b297d9a919471c92b02ecf6cc9554457211
 
gga 
parents: 
6 
diff
changeset
 | 
608 if 'WRITE' in x['permissions'] or 'READ' in x['permissions'] or 'ADMINISTRATE' in x['permissions'] or user.role == 'ADMIN' | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
609 } | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
610 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
611 if 'error' in orgs: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
612 raise Exception("Error received from Apollo server: \"%s\"" % orgs['error']) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
613 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
614 return [ | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
615 (org['commonName'], org['id'], False) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
616 for org in sorted(orgs, key=lambda x: x['commonName']) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
617 if org['commonName'] in permissionMap | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
618 ] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
619 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
620 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
621 def galaxy_list_groups(trans, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
622 email = trans.get_user().email | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
623 wa = WebApolloInstance() | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
624 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
625 # Key for cached data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
626 cacheKey = 'groups-' + email | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
627 # We don't want to trust "if key in cache" because between asking and fetch | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
628 # it might through key error. | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
629 if cacheKey not in cache: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
630 # However if it ISN'T there, we know we're safe to fetch + put in | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
631 # there. | 
| 
6
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
632 data = _galaxy_list_groups(wa, *args, **kwargs) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
633 cache[cacheKey] = data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
634 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
635 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
636 # The cache key may or may not be in the cache at this point, it | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
637 # /likely/ is. However we take no chances that it wasn't evicted between | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
638 # when we checked above and now, so we reference the object from the | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
639 # cache in preparation to return. | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
640 data = cache[cacheKey] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
641 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
642 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
643 # If access fails due to eviction, we will fail over and can ensure that | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
644 # data is inserted. | 
| 
6
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
645 data = _galaxy_list_groups(wa, *args, **kwargs) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
646 cache[cacheKey] = data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
647 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
648 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
649 | 
| 
6
 
16898d7ed49f
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
 
gga 
parents: 
5 
diff
changeset
 | 
650 def _galaxy_list_groups(wa, *args, **kwargs): | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
651 # Fetch the groups. | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
652 group_data = [] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
653 for group in wa.groups.loadGroups(): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
654 # Reformat | 
| 
2
 
5fbce9e09d27
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 33ce5bd0cce35a12725b9ef9aed0683f3c41fbf9
 
gga 
parents: 
0 
diff
changeset
 | 
655 group_data.append((group.name, group.name, False)) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
656 return group_data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
657 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
658 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
659 def galaxy_list_orgs(trans, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
660 email = trans.get_user().email | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
661 wa = WebApolloInstance() | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
662 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
663 gx_user = wa.requireUser(email) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
664 except UnknownUserException: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
665 return [] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
666 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
667 # Key for cached data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
668 cacheKey = 'orgs-' + email | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
669 if cacheKey not in cache: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
670 data = _galaxy_list_orgs(wa, gx_user, *args, **kwargs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
671 cache[cacheKey] = data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
672 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
673 try: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
674 data = cache[cacheKey] | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
675 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
676 except KeyError: | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
677 data = _galaxy_list_orgs(wa, gx_user, *args, **kwargs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
678 cache[cacheKey] = data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
679 return data | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
680 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
681 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
682 def _galaxy_list_orgs(wa, gx_user, *args, **kwargs): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
683 # Fetch all organisms | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
684 all_orgs = wa.organisms.findAllOrganisms() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
685 # Figure out which are accessible to the user | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
686 orgs = accessible_organisms(gx_user, all_orgs) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
687 # Return org list | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
688 return orgs | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
689 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
690 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
691 # This is all for implementing the command line interface for testing. | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
692 class obj(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
693 pass | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
694 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
695 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
696 class fakeTrans(object): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
697 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
698 def __init__(self, username): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
699 self.un = username | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
700 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
701 def get_user(self): | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
702 o = obj() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
703 o.email = self.un | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
704 return o | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
705 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
706 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
707 if __name__ == '__main__': | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
708 parser = argparse.ArgumentParser(description='Test access to apollo server') | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
709 parser.add_argument('email', help='Email of user to test') | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
710 parser.add_argument('--action', choices=['org', 'group'], default='org', help='Data set to test, fetch a list of groups or orgs known to the requesting user.') | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
711 args = parser.parse_args() | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
712 | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
713 trans = fakeTrans(args.email) | 
| 
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
714 if args.action == 'org': | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
715 print(galaxy_list_orgs(trans)) | 
| 
0
 
59c93880cd65
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
 
gga 
parents:  
diff
changeset
 | 
716 elif args.action == 'group': | 
| 
13
 
86b18242f380
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
 
gga 
parents: 
7 
diff
changeset
 | 
717 print(galaxy_list_groups(trans)) | 
