@@ -117,9 +117,8 @@ def team_id(self, value: Optional[UUID]):
117117 @classmethod
118118 def get_team_id_from_project_id (cls , session : Session , project_id : UUID ):
119119 """Returns the UUID of the Team that owns the project with the provided project_id."""
120- return session .get_resource (
121- path = f'projects/{ project_id } ' ,
122- version = "v3" )['project' ]['team' ]['id' ]
120+ response = session .get_resource (path = f'projects/{ project_id } ' , version = "v3" )
121+ return response ['project' ]['team' ]['id' ]
123122
124123 @property
125124 def branches (self ) -> BranchCollection :
@@ -318,12 +317,10 @@ def ingredient_specs(self) -> IngredientSpecCollection:
318317 details = "Please use 'Team.gemd' instead.'" )
319318 def gemd (self ) -> GEMDResourceCollection :
320319 """Return a resource representing all GEMD objects/templates in this dataset."""
321- return GEMDResourceCollection (
322- project_id = self .uid ,
323- dataset_id = None ,
324- session = self .session ,
325- team_id = self .team_id
326- )
320+ return GEMDResourceCollection (project_id = self .uid ,
321+ dataset_id = None ,
322+ session = self .session ,
323+ team_id = self .team_id )
327324
328325 @property
329326 def table_configs (self ) -> TableConfigCollection :
@@ -360,7 +357,8 @@ def publish(self, *, resource: Resource):
360357 else :
361358 self .session .checked_post (
362359 f"{ self ._path ()} /published-resources/{ resource_type } /batch-publish" ,
363- version = 'v3' , json = {'ids' : [resource_access ["id" ]]})
360+ version = 'v3' ,
361+ json = {'ids' : [resource_access ["id" ]]})
364362 return True
365363
366364 def un_publish (self , * , resource : Resource ):
@@ -387,7 +385,8 @@ def un_publish(self, *, resource: Resource):
387385 else :
388386 self .session .checked_post (
389387 f"{ self ._path ()} /published-resources/{ resource_type } /batch-un-publish" ,
390- version = 'v3' , json = {'ids' : [resource_access ["id" ]]})
388+ version = 'v3' ,
389+ json = {'ids' : [resource_access ["id" ]]})
391390 return True
392391
393392 def pull_in_resource (self , * , resource : Resource ):
@@ -415,7 +414,8 @@ def pull_in_resource(self, *, resource: Resource):
415414 base_url = f'/teams/{ self .team_id } { self ._path ()} '
416415 self .session .checked_post (
417416 f'{ base_url } /outside-resources/{ resource_type } /batch-pull-in' ,
418- version = 'v3' , json = {'ids' : [resource_access ["id" ]]})
417+ version = 'v3' ,
418+ json = {'ids' : [resource_access ["id" ]]})
419419 return True
420420
421421 def owned_dataset_ids (self ) -> List [str ]:
@@ -434,9 +434,10 @@ def owned_dataset_ids(self) -> List[str]:
434434 DeprecationWarning
435435 )
436436 query_params = {"userId" : "" , "domain" : self ._path (), "action" : "WRITE" }
437- return self .session .get_resource ("/DATASET/authorized-ids" ,
438- params = query_params ,
439- version = "v3" )['ids' ]
437+ response = self .session .get_resource ("/DATASET/authorized-ids" ,
438+ params = query_params ,
439+ version = "v3" )
440+ return response ['ids' ]
440441
441442 def list_members (self ) -> Union [List [ProjectMember ], List ["TeamMember" ]]: # noqa: F821
442443 """
@@ -449,6 +450,7 @@ def list_members(self) -> Union[List[ProjectMember], List["TeamMember"]]: # noq
449450 containing the project if teams have been released.
450451
451452 """
453+ # Preventing a cyclical import.
452454 from citrine .resources .team import TeamCollection
453455
454456 team_collection = TeamCollection (self .session )
@@ -457,13 +459,11 @@ def list_members(self) -> Union[List[ProjectMember], List["TeamMember"]]: # noq
457459
458460 @deprecated (deprecated_in = "3.4.0" , removed_in = "4.0.0" ,
459461 details = "Please use 'Team.gemd_batch_delete' instead.'" )
460- def gemd_batch_delete (
461- self ,
462- id_list : List [Union [LinkByUID , UUID , str , BaseEntity ]],
463- * ,
464- timeout : float = 2 * 60 ,
465- polling_delay : float = 1.0
466- ) -> List [Tuple [LinkByUID , ApiError ]]:
462+ def gemd_batch_delete (self ,
463+ id_list : List [Union [LinkByUID , UUID , str , BaseEntity ]],
464+ * ,
465+ timeout : float = 2 * 60 ,
466+ polling_delay : float = 1.0 ) -> List [Tuple [LinkByUID , ApiError ]]:
467467 """
468468 Remove a set of GEMD objects.
469469
@@ -550,7 +550,7 @@ def build(self, data) -> Project:
550550 project .team_id = self .team_id
551551 return project
552552
553- def register (self , name : str , * , description : Optional [str ] = None ):
553+ def register (self , name : str , * , description : Optional [str ] = None ) -> Project :
554554 """
555555 Create and upload new project.
556556
@@ -659,7 +659,9 @@ def search_all(self, search_params: Optional[Dict]) -> Iterable[Dict]:
659659
660660 return collections
661661
662- def search (self , * , search_params : Optional [dict ] = None ,
662+ def search (self ,
663+ * ,
664+ search_params : Optional [dict ] = None ,
663665 per_page : int = 1000 ) -> Iterable [Project ]:
664666 """
665667 Search for projects matching the desired name or description.
0 commit comments