@@ -117,9 +117,8 @@ def team_id(self, value: Optional[UUID]):
117
117
@classmethod
118
118
def get_team_id_from_project_id (cls , session : Session , project_id : UUID ):
119
119
"""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' ]
123
122
124
123
@property
125
124
def branches (self ) -> BranchCollection :
@@ -318,12 +317,10 @@ def ingredient_specs(self) -> IngredientSpecCollection:
318
317
details = "Please use 'Team.gemd' instead.'" )
319
318
def gemd (self ) -> GEMDResourceCollection :
320
319
"""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 )
327
324
328
325
@property
329
326
def table_configs (self ) -> TableConfigCollection :
@@ -360,7 +357,8 @@ def publish(self, *, resource: Resource):
360
357
else :
361
358
self .session .checked_post (
362
359
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" ]]})
364
362
return True
365
363
366
364
def un_publish (self , * , resource : Resource ):
@@ -387,7 +385,8 @@ def un_publish(self, *, resource: Resource):
387
385
else :
388
386
self .session .checked_post (
389
387
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" ]]})
391
390
return True
392
391
393
392
def pull_in_resource (self , * , resource : Resource ):
@@ -415,7 +414,8 @@ def pull_in_resource(self, *, resource: Resource):
415
414
base_url = f'/teams/{ self .team_id } { self ._path ()} '
416
415
self .session .checked_post (
417
416
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" ]]})
419
419
return True
420
420
421
421
def owned_dataset_ids (self ) -> List [str ]:
@@ -434,9 +434,10 @@ def owned_dataset_ids(self) -> List[str]:
434
434
DeprecationWarning
435
435
)
436
436
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' ]
440
441
441
442
def list_members (self ) -> Union [List [ProjectMember ], List ["TeamMember" ]]: # noqa: F821
442
443
"""
@@ -449,6 +450,7 @@ def list_members(self) -> Union[List[ProjectMember], List["TeamMember"]]: # noq
449
450
containing the project if teams have been released.
450
451
451
452
"""
453
+ # Preventing a cyclical import.
452
454
from citrine .resources .team import TeamCollection
453
455
454
456
team_collection = TeamCollection (self .session )
@@ -457,13 +459,11 @@ def list_members(self) -> Union[List[ProjectMember], List["TeamMember"]]: # noq
457
459
458
460
@deprecated (deprecated_in = "3.4.0" , removed_in = "4.0.0" ,
459
461
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 ]]:
467
467
"""
468
468
Remove a set of GEMD objects.
469
469
@@ -550,7 +550,7 @@ def build(self, data) -> Project:
550
550
project .team_id = self .team_id
551
551
return project
552
552
553
- def register (self , name : str , * , description : Optional [str ] = None ):
553
+ def register (self , name : str , * , description : Optional [str ] = None ) -> Project :
554
554
"""
555
555
Create and upload new project.
556
556
@@ -659,7 +659,9 @@ def search_all(self, search_params: Optional[Dict]) -> Iterable[Dict]:
659
659
660
660
return collections
661
661
662
- def search (self , * , search_params : Optional [dict ] = None ,
662
+ def search (self ,
663
+ * ,
664
+ search_params : Optional [dict ] = None ,
663
665
per_page : int = 1000 ) -> Iterable [Project ]:
664
666
"""
665
667
Search for projects matching the desired name or description.
0 commit comments