def __getitem__(self, x): """ Get a job by positional index. Examples: tasks[-1] : get last job, tasks[0] : get first job, tasks[1] : get second job. """ return _wrap(stripProxy(self).__getitem__(_unwrap(x)))
def __call__(self, x): """ Access individual job. Examples: tasks(10) : get job with id 10 or raise exception if it does not exist. tasks((10,2)) : get transform number 2 of task 10 if exist or raise exception. tasks('10.2')) : same as above """ return _wrap(stripProxy(self).__call__(x))
def __call__(self, id): """ Retrieve an object by id. """ if isinstance(id, str): if id.isdigit(): id = int(id) else: matches = [ o for o in self.objects if fnmatch.fnmatch(o.name, id)] if len(matches) > 1: logger.error( 'Multiple Matches: Wildcards are allowed for ease of matching, however') logger.error( ' to keep a uniform response only one item may be matched.') logger.error( ' If you wanted a slice, please use the select method') raise RegistryKeyError( "Multiple matches for id='%s':%s" % (id, str(map(lambda x: x.name, matches)))) if len(matches) < 1: return _wrap(TransientRegistrySlice(self.name)) return matches[0] try: return self.objects[id] except KeyError: raise RegistryKeyError('Object id=%d not found' % id)
def __getslice__(self, i1, i2): """ Get a slice. Examples: tasks[2:] : get first two tasks, tasks[-10:] : get last 10 tasks. """ return _wrap(stripProxy(self).__getslice__(i1, i2))
def __getslice__(self, i1, i2): """ Get a slice. Examples: """ return _wrap(stripProxy(self).__getslice__(i1, i2))
def __getitem__(self, x): """ Get an item by positional index. Examples: """ return _wrap(stripProxy(self).__getitem__(x))
def __call__(self, x): """ Access individual object. Examples: """ return _wrap(stripProxy(self).__call__(x))