14
14
15
15
"""Shared testing utilities."""
16
16
17
-
18
- # Avoid the grpc and google.cloud.grpc collision.
19
17
from __future__ import absolute_import
20
18
21
19
22
20
class _Monkey (object ):
23
- # context -manager for replacing module names in the scope of a test.
21
+ """Context -manager for replacing module names in the scope of a test."""
24
22
25
23
def __init__ (self , module , ** kw ):
26
24
self .module = module
27
- if len ( kw ) == 0 : # pragma: NO COVER
25
+ if not kw : # pragma: NO COVER
28
26
raise ValueError ('_Monkey was used with nothing to monkey-patch' )
29
27
self .to_restore = {key : getattr (module , key ) for key in kw }
30
28
for key , value in kw .items ():
@@ -68,8 +66,12 @@ def _tempdir_mgr():
68
66
return _tempdir_mgr
69
67
70
68
69
+ # pylint: disable=invalid-name
70
+ # Retain _tempdir as a constant for backwards compatibility despite
71
+ # being an invalid name.
71
72
_tempdir = _tempdir_maker ()
72
73
del _tempdir_maker
74
+ # pylint: enable=invalid-name
73
75
74
76
75
77
class _GAXBaseAPI (object ):
@@ -79,7 +81,8 @@ class _GAXBaseAPI(object):
79
81
def __init__ (self , ** kw ):
80
82
self .__dict__ .update (kw )
81
83
82
- def _make_grpc_error (self , status_code , trailing = None ):
84
+ @staticmethod
85
+ def _make_grpc_error (status_code , trailing = None ):
83
86
from grpc ._channel import _RPCState
84
87
from google .cloud .exceptions import GrpcRendezvous
85
88
@@ -111,6 +114,7 @@ def __init__(self, *pages, **kwargs):
111
114
self .page_token = kwargs .get ('page_token' )
112
115
113
116
def next (self ):
117
+ """Iterate to the next page."""
114
118
import six
115
119
return six .next (self ._pages )
116
120
0 commit comments