Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1fbee03

Browse files
authored
fix: undprecate entity factory helpers (#101)
Closes#100
1 parentd368c4b commit1fbee03

File tree

2 files changed

+6
-75
lines changed

2 files changed

+6
-75
lines changed

‎google/api_core/iam.py‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@
7474
_ASSIGNMENT_DEPRECATED_MSG="""\
7575
Assigning to '{}' is deprecated. Use the `policy.bindings` property to modify bindings instead."""
7676

77-
_FACTORY_DEPRECATED_MSG="""\
78-
Factory method {0} is deprecated. Replace with '{0}'."""
79-
8077
_DICT_ACCESS_MSG="""\
8178
Dict access is not supported on policies with version > 1 or with conditional bindings."""
8279

@@ -323,12 +320,7 @@ def user(email):
323320
324321
Returns:
325322
str: A member string corresponding to the given user.
326-
327-
DEPRECATED: set the role `user:{email}` in the binding instead.
328323
"""
329-
warnings.warn(
330-
_FACTORY_DEPRECATED_MSG.format("user:{email}"),DeprecationWarning,
331-
)
332324
return"user:%s"% (email,)
333325

334326
@staticmethod
@@ -341,12 +333,7 @@ def service_account(email):
341333
Returns:
342334
str: A member string corresponding to the given service account.
343335
344-
DEPRECATED: set the role `serviceAccount:{email}` in the binding instead.
345336
"""
346-
warnings.warn(
347-
_FACTORY_DEPRECATED_MSG.format("serviceAccount:{email}"),
348-
DeprecationWarning,
349-
)
350337
return"serviceAccount:%s"% (email,)
351338

352339
@staticmethod
@@ -358,12 +345,7 @@ def group(email):
358345
359346
Returns:
360347
str: A member string corresponding to the given group.
361-
362-
DEPRECATED: set the role `group:{email}` in the binding instead.
363348
"""
364-
warnings.warn(
365-
_FACTORY_DEPRECATED_MSG.format("group:{email}"),DeprecationWarning,
366-
)
367349
return"group:%s"% (email,)
368350

369351
@staticmethod
@@ -375,12 +357,7 @@ def domain(domain):
375357
376358
Returns:
377359
str: A member string corresponding to the given domain.
378-
379-
DEPRECATED: set the role `domain:{email}` in the binding instead.
380360
"""
381-
warnings.warn(
382-
_FACTORY_DEPRECATED_MSG.format("domain:{email}"),DeprecationWarning,
383-
)
384361
return"domain:%s"% (domain,)
385362

386363
@staticmethod
@@ -389,12 +366,7 @@ def all_users():
389366
390367
Returns:
391368
str: A member string representing all users.
392-
393-
DEPRECATED: set the role `allUsers` in the binding instead.
394369
"""
395-
warnings.warn(
396-
_FACTORY_DEPRECATED_MSG.format("allUsers"),DeprecationWarning,
397-
)
398370
return"allUsers"
399371

400372
@staticmethod
@@ -403,12 +375,7 @@ def authenticated_users():
403375
404376
Returns:
405377
str: A member string representing all authenticated users.
406-
407-
DEPRECATED: set the role `allAuthenticatedUsers` in the binding instead.
408378
"""
409-
warnings.warn(
410-
_FACTORY_DEPRECATED_MSG.format("allAuthenticatedUsers"),DeprecationWarning,
411-
)
412379
return"allAuthenticatedUsers"
413380

414381
@classmethod

‎tests/unit/test_iam.py‎

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -230,72 +230,36 @@ def test_viewers_setter(self):
230230
assertpolicy[VIEWER_ROLE]==expected
231231

232232
deftest_user(self):
233-
importwarnings
234-
235233
EMAIL="phred@example.com"
236234
MEMBER="user:%s"% (EMAIL,)
237235
policy=self._make_one()
238-
withwarnings.catch_warnings(record=True)aswarned:
239-
assertpolicy.user(EMAIL)==MEMBER
240-
241-
(warning,)=warned
242-
assertwarning.categoryisDeprecationWarning
236+
assertpolicy.user(EMAIL)==MEMBER
243237

244238
deftest_service_account(self):
245-
importwarnings
246-
247239
EMAIL="phred@example.com"
248240
MEMBER="serviceAccount:%s"% (EMAIL,)
249241
policy=self._make_one()
250-
withwarnings.catch_warnings(record=True)aswarned:
251-
assertpolicy.service_account(EMAIL)==MEMBER
252-
253-
(warning,)=warned
254-
assertwarning.categoryisDeprecationWarning
242+
assertpolicy.service_account(EMAIL)==MEMBER
255243

256244
deftest_group(self):
257-
importwarnings
258-
259245
EMAIL="phred@example.com"
260246
MEMBER="group:%s"% (EMAIL,)
261247
policy=self._make_one()
262-
withwarnings.catch_warnings(record=True)aswarned:
263-
assertpolicy.group(EMAIL)==MEMBER
264-
265-
(warning,)=warned
266-
assertwarning.categoryisDeprecationWarning
248+
assertpolicy.group(EMAIL)==MEMBER
267249

268250
deftest_domain(self):
269-
importwarnings
270-
271251
DOMAIN="example.com"
272252
MEMBER="domain:%s"% (DOMAIN,)
273253
policy=self._make_one()
274-
withwarnings.catch_warnings(record=True)aswarned:
275-
assertpolicy.domain(DOMAIN)==MEMBER
276-
277-
(warning,)=warned
278-
assertwarning.categoryisDeprecationWarning
254+
assertpolicy.domain(DOMAIN)==MEMBER
279255

280256
deftest_all_users(self):
281-
importwarnings
282-
283257
policy=self._make_one()
284-
withwarnings.catch_warnings(record=True)aswarned:
285-
assertpolicy.all_users()=="allUsers"
286-
287-
(warning,)=warned
288-
assertwarning.categoryisDeprecationWarning
258+
assertpolicy.all_users()=="allUsers"
289259

290260
deftest_authenticated_users(self):
291-
importwarnings
292-
293261
policy=self._make_one()
294-
withwarnings.catch_warnings(record=True)aswarned:
295-
assertpolicy.authenticated_users()=="allAuthenticatedUsers"
296-
297-
(warning,)=warned
298-
assertwarning.categoryisDeprecationWarning
262+
assertpolicy.authenticated_users()=="allAuthenticatedUsers"
299263

300264
deftest_from_api_repr_only_etag(self):
301265
empty=frozenset()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp