@@ -51,6 +51,7 @@ class Project(object):
5151 :type labels: dict
5252 :param labels: A list of labels associated with the project.
5353 """
54+
5455 def __init__ (self , project_id , client , name = None , labels = None ):
5556 self ._client = client
5657 self .project_id = project_id
@@ -61,7 +62,7 @@ def __init__(self, project_id, client, name=None, labels=None):
6162 self .parent = None
6263
6364 def __repr__ (self ):
64- return ' <Project: %r (%r)>' % (self .name , self .project_id )
65+ return " <Project: %r (%r)>" % (self .name , self .project_id )
6566
6667 @classmethod
6768 def from_api_repr (cls , resource , client ):
@@ -76,30 +77,30 @@ def from_api_repr(cls, resource, client):
7677 :rtype: :class:`google.cloud.resource_manager.project.Project`
7778 :returns: The project created.
7879 """
79- project = cls (project_id = resource [' projectId' ], client = client )
80+ project = cls (project_id = resource [" projectId" ], client = client )
8081 project .set_properties_from_api_repr (resource )
8182 return project
8283
8384 def set_properties_from_api_repr (self , resource ):
8485 """Update specific properties from its API representation."""
85- self .name = resource .get (' name' )
86- self .number = resource [' projectNumber' ]
87- self .labels = resource .get (' labels' , {})
88- self .status = resource [' lifecycleState' ]
89- if ' parent' in resource :
90- self .parent = resource [' parent' ]
86+ self .name = resource .get (" name" )
87+ self .number = resource [" projectNumber" ]
88+ self .labels = resource .get (" labels" , {})
89+ self .status = resource [" lifecycleState" ]
90+ if " parent" in resource :
91+ self .parent = resource [" parent" ]
9192
9293 @property
9394 def full_name (self ):
9495 """Fully-qualified name (ie, ``'projects/purple-spaceship-123'``)."""
9596 if not self .project_id :
96- raise ValueError (' Missing project ID.' )
97- return ' projects/%s' % (self .project_id )
97+ raise ValueError (" Missing project ID." )
98+ return " projects/%s" % (self .project_id )
9899
99100 @property
100101 def path (self ):
101102 """URL for the project (ie, ``'/projects/purple-spaceship-123'``)."""
102- return ' /%s' % (self .full_name )
103+ return " /%s" % (self .full_name )
103104
104105 def _require_client (self , client ):
105106 """Check client or verify over-ride.
@@ -129,13 +130,10 @@ def create(self, client=None):
129130 """
130131 client = self ._require_client (client )
131132
132- data = {
133- 'projectId' : self .project_id ,
134- 'name' : self .name ,
135- 'labels' : self .labels ,
136- }
137- resp = client ._connection .api_request (method = 'POST' , path = '/projects' ,
138- data = data )
133+ data = {"projectId" : self .project_id , "name" : self .name , "labels" : self .labels }
134+ resp = client ._connection .api_request (
135+ method = "POST" , path = "/projects" , data = data
136+ )
139137 self .set_properties_from_api_repr (resource = resp )
140138
141139 def reload (self , client = None ):
@@ -164,7 +162,7 @@ def reload(self, client=None):
164162
165163 # We assume the project exists. If it doesn't it will raise a NotFound
166164 # exception.
167- resp = client ._connection .api_request (method = ' GET' , path = self .path )
165+ resp = client ._connection .api_request (method = " GET" , path = self .path )
168166 self .set_properties_from_api_repr (resource = resp )
169167
170168 def exists (self , client = None ):
@@ -186,7 +184,7 @@ def exists(self, client=None):
186184 try :
187185 # Note that we have to request the entire resource as the API
188186 # doesn't provide a way tocheck for existence only.
189- client ._connection .api_request (method = ' GET' , path = self .path )
187+ client ._connection .api_request (method = " GET" , path = self .path )
190188 except NotFound :
191189 return False
192190 else :
@@ -205,14 +203,9 @@ def update(self, client=None):
205203 """
206204 client = self ._require_client (client )
207205
208- data = {
209- 'name' : self .name ,
210- 'labels' : self .labels ,
211- 'parent' : self .parent ,
212- }
206+ data = {"name" : self .name , "labels" : self .labels , "parent" : self .parent }
213207
214- resp = client ._connection .api_request (
215- method = 'PUT' , path = self .path , data = data )
208+ resp = client ._connection .api_request (method = "PUT" , path = self .path , data = data )
216209 self .set_properties_from_api_repr (resp )
217210
218211 def delete (self , client = None , reload_data = False ):
@@ -240,7 +233,7 @@ def delete(self, client=None, reload_data=False):
240233 Default: :data:`False`.
241234 """
242235 client = self ._require_client (client )
243- client ._connection .api_request (method = ' DELETE' , path = self .path )
236+ client ._connection .api_request (method = " DELETE" , path = self .path )
244237
245238 # If the reload flag is set, reload the project.
246239 if reload_data :
@@ -270,8 +263,7 @@ def undelete(self, client=None, reload_data=False):
270263 Default: :data:`False`.
271264 """
272265 client = self ._require_client (client )
273- client ._connection .api_request (
274- method = 'POST' , path = self .path + ':undelete' )
266+ client ._connection .api_request (method = "POST" , path = self .path + ":undelete" )
275267
276268 # If the reload flag is set, reload the project.
277269 if reload_data :
0 commit comments