Package intermine :: Package lists :: Module listmanager :: Class ListManager
[hide private]
[frames] | no frames]

Class ListManager

source code

object --+
         |
        ListManager

A Class for Managing List Content and Operations

This class serves as a delegate for the intermine.webservice.Service class, managing list content and operations.

This class is not meant to be called itself, but rather for its methods to be called by the service object.

Note that the methods for creating lists can conflict in threaded applications, if two threads are each allocated the same unused list name. You are strongly advised to use locks to synchronise any list creation requests (create_list, or intersect, union, subtract, diff) unless you are choosing your own names each time.

Instance Methods [hide private]
 
__init__(self, service)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
refresh_lists(self)
Update the list information with the latest details from the server
source code
 
get_list(self, name)
Return a list from the service by name, if it exists
source code
 
l(self, name)
Alias for get_list
source code
 
get_all_lists(self)
Get all the lists on a webservice
source code
 
get_all_list_names(self)
Get all the names of the lists in a particular webservice
source code
 
get_list_count(self)
Return the number of lists accessible at the given webservice.
source code
 
get_unused_list_name(self)
This method returns a new name that does not conflict with any currently existing list name.
source code
 
_get_listable_query(self, queryable) source code
 
_create_list_from_queryable(self, queryable, name, description, tags) source code
intermine.lists.List
create_list(self, content, list_type='', name=None, description=None, tags=[])
If no name is given, the list will be considered to be a temporary list, and will be automatically deleted when the program ends.
source code
 
parse_list_upload_response(self, response)
Intepret the response from the webserver to a list request, and return the List it describes
source code
 
delete_lists(self, lists)
Delete the given lists from the webserver
source code
 
remove_tags(self, to_remove_from, tags)
Returns the current tags of this list.
source code
 
add_tags(self, to_tag, tags)
Returns the current tags of this list.
source code
 
get_tags(self, im_list)
Returns the current tags of this list.
source code
 
_body_to_json(self, body) source code
 
delete_temporary_lists(self)
Delete all the lists considered temporary (those created without names)
source code
 
intersect(self, lists, name=None, description=None, tags=[])
Calculate the intersection of a given set of lists, and return the list representing the result
source code
 
union(self, lists, name=None, description=None, tags=[])
Calculate the union of a given set of lists, and return the list representing the result
source code
 
xor(self, lists, name=None, description=None, tags=[])
Calculate the symmetric difference of a given set of lists, and return the list representing the result
source code
 
subtract(self, lefts, rights, name=None, description=None, tags=[])
Calculate the subtraction of rights from lefts, and return the list representing the result
source code
 
_do_operation(self, path, operation, lists, name, description, tags) source code
 
make_list_names(self, lists)
Turn a list of things into a list of list names
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
safe_dict(d)
Recursively clone json structure with UTF-8 dictionary keys
source code
Class Variables [hide private]
  DEFAULT_LIST_NAME = 'my_list_'
  DEFAULT_DESCRIPTION = 'List created with Python client library'
  INTERSECTION_PATH = '/lists/intersect/json'
  UNION_PATH = '/lists/union/json'
  DIFFERENCE_PATH = '/lists/diff/json'
  SUBTRACTION_PATH = '/lists/subtract/json'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, service)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

get_list_count(self)

source code 

Return the number of lists accessible at the given webservice. This number will vary depending on who you are authenticated as.

get_unused_list_name(self)

source code 

Get an unused list name

This method returns a new name that does not conflict with any currently existing list name.

The list name is only guaranteed to be unused at the time of allocation.

create_list(self, content, list_type='', name=None, description=None, tags=[])

source code 

Create a new list in the webservice

If no name is given, the list will be considered to be a temporary list, and will be automatically deleted when the program ends. To prevent this happening, give the list a name, either on creation, or by renaming it.

This method is not thread safe for anonymous lists - it will need synchronisation with locks if you intend to create lists with multiple threads in parallel.

Returns: intermine.lists.List