@@ -98,7 +98,7 @@ def refresh_lists(self):
9898
9999 l = ListManager .safe_dict (l )
100100 self .lists [l ['name' ]] = List (service = self .service ,
101- manager = self , ** l )
101+ manager = self , ** l )
102102
103103 @staticmethod
104104 def safe_dict (d ):
@@ -173,7 +173,8 @@ def _get_listable_query(self, queryable):
173173 q .add_view (q .root .name + '.id' )
174174 else :
175175
176- # Check to see if the class of the selected items is unambiguous
176+ # Check to see if the class of the selected items is
177+ # unambiguous
177178
178179 up_to_attrs = set (v [0 :v .rindex ('.' )] for v in q .views )
179180 if len (up_to_attrs ) == 1 :
@@ -186,7 +187,7 @@ def _create_list_from_queryable(
186187 name ,
187188 description ,
188189 tags ,
189- ):
190+ ):
190191
191192 q = self ._get_listable_query (queryable )
192193 uri = q .get_list_upload_uri ()
@@ -209,7 +210,7 @@ def create_list(
209210 tags = [],
210211 add = [],
211212 organism = None ,
212- ):
213+ ):
213214 """
214215 Create a new list in the webservice
215216 ===================================
@@ -279,7 +280,7 @@ def create_list(
279280
280281 if isinstance (organism , list ):
281282 query .add_constraint ('{0}.organism.name' .format (list_type ),
282- 'ONE OF' , organism )
283+ 'ONE OF' , organism )
283284 else :
284285 query .add_constraint ('organism' , 'LOOKUP' , organism )
285286 if isinstance (item_content , list ):
@@ -289,7 +290,8 @@ def create_list(
289290 query .add_constraint ('symbol' , 'ONE OF' , item_content )
290291
291292 # If one wants to create a list while
292- # specifying an organism, then a content should not be passed.
293+ # specifying an organism, then a content should not be
294+ # passed.
293295
294296 item_content = query
295297
@@ -298,30 +300,32 @@ def create_list(
298300 except AttributeError :
299301 try :
300302 with closing (codecs .open (item_content , 'r' , 'UTF-8'
301- )) as c : # File name
303+ )) as c : # File name
302304 ids = c .read ()
303305 except (TypeError , IOError ):
304306 try :
305307 ids = item_content .strip () # Stringy thing
306308 except AttributeError :
307309 try : # Queryable
308- return self ._create_list_from_queryable (item_content ,
309- name , description , tags )
310+ return self ._create_list_from_queryable (
311+ item_content , name ,
312+ description , tags )
310313 except AttributeError :
311314 try : # Array of idents
312315 idents = iter (item_content )
313- ids = '\n ' .join (map ('"{0}"' .format , idents ))
316+ ids = '\n ' .join (
317+ map ('"{0}"' .format , idents ))
314318 except AttributeError :
315319 raise TypeError ('Cannot create list from '
316- + repr (item_content ))
320+ + repr (item_content ))
317321
318322 uri = self .service .root + self .service .LIST_CREATION_PATH
319323 query_form = {
320324 'name' : name ,
321325 'type' : list_type ,
322326 'description' : description ,
323327 'tags' : ';' .join (tags ),
324- }
328+ }
325329 if len (add ):
326330 query_form ['add' ] = [x .lower () for x in add if x ]
327331
@@ -362,7 +366,8 @@ def delete_lists(self, lists):
362366 else :
363367 name = str (l )
364368 if name not in all_names :
365- self .LOG .debug ('{0} does not exist - skipping' .format (name ))
369+ self .LOG .debug (
370+ '{0} does not exist - skipping' .format (name ))
366371 continue
367372 self .LOG .debug ('deleting {0}' .format (name ))
368373 uri = self .service .root + self .service .LIST_PATH
@@ -436,10 +441,10 @@ def __exit__(
436441 exc_type ,
437442 exc_val ,
438443 traceback ,
439- ):
444+ ):
440445
441446 self .LOG .debug ('Exiting context - deleting {0}' .format (
442- self ._temp_lists ))
447+ self ._temp_lists ))
443448 self .delete_temporary_lists ()
444449
445450 def delete_temporary_lists (self ):
@@ -457,7 +462,7 @@ def intersect(
457462 name = None ,
458463 description = None ,
459464 tags = [],
460- ):
465+ ):
461466 """
462467 Calculate the intersection of a given set of lists, and return the
463468 list representing the result
@@ -470,15 +475,15 @@ def intersect(
470475 name ,
471476 description ,
472477 tags ,
473- )
478+ )
474479
475480 def union (
476481 self ,
477482 lists ,
478483 name = None ,
479484 description = None ,
480485 tags = [],
481- ):
486+ ):
482487 """
483488 Calculate the union of a given set of lists,
484489 and return the list representing the result
@@ -491,15 +496,15 @@ def union(
491496 name ,
492497 description ,
493498 tags ,
494- )
499+ )
495500
496501 def xor (
497502 self ,
498503 lists ,
499504 name = None ,
500505 description = None ,
501506 tags = [],
502- ):
507+ ):
503508 """
504509 Calculate the symmetric difference of a given set of lists,
505510 and return the list representing the result
@@ -512,7 +517,7 @@ def xor(
512517 name ,
513518 description ,
514519 tags ,
515- )
520+ )
516521
517522 def subtract (
518523 self ,
@@ -521,7 +526,7 @@ def subtract(
521526 name = None ,
522527 description = None ,
523528 tags = [],
524- ):
529+ ):
525530 """
526531 Calculate the subtraction of rights from lefts,
527532 and return the list representing the result
@@ -541,7 +546,7 @@ def subtract(
541546 'references' : ';' .join (left_names ),
542547 'subtract' : ';' .join (right_names ),
543548 'tags' : ';' .join (tags ),
544- })
549+ })
545550 resp = self .service .opener .open (uri )
546551 data = resp .read ()
547552 resp .close ()
@@ -555,11 +560,12 @@ def _do_operation(
555560 name ,
556561 description ,
557562 tags ,
558- ):
563+ ):
559564
560565 list_names = self .make_list_names (lists )
561566 if description is None :
562- description = operation + ' of ' + ' and ' .join (list_names )
567+ description = operation + ' of ' + \
568+ ' and ' .join (list_names )
563569 if name is None :
564570 name = self .get_unused_list_name ()
565571 uri = self .service .root + path
@@ -568,7 +574,7 @@ def _do_operation(
568574 'lists' : ';' .join (list_names ),
569575 'description' : description ,
570576 'tags' : ';' .join (tags ),
571- })
577+ })
572578 resp = self .service .opener .open (uri )
573579 data = resp .read ()
574580 resp .close ()
0 commit comments