diff --git a/google/api_core/__init__.py b/google/api_core/__init__.py index 605dd8be..b80ea372 100644 --- a/google/api_core/__init__.py +++ b/google/api_core/__init__.py @@ -14,7 +14,7 @@ """Google API Core. -This package contains common code and utilties used by Google client libraries. +This package contains common code and utilities used by Google client libraries. """ from google.api_core import version as api_core_version diff --git a/google/api_core/client_info.py b/google/api_core/client_info.py index 3e4376c9..48326799 100644 --- a/google/api_core/client_info.py +++ b/google/api_core/client_info.py @@ -48,7 +48,7 @@ class ClientInfo(object): ``'3.9.6'``. grpc_version (Optional[str]): The gRPC library version. api_core_version (str): The google-api-core library version. - gapic_version (Optional[str]): The sversion of gapic-generated client + gapic_version (Optional[str]): The version of gapic-generated client library, if the library was generated by gapic. client_library_version (Optional[str]): The version of the client library, generally used if the client library was not generated diff --git a/google/api_core/datetime_helpers.py b/google/api_core/datetime_helpers.py index 9470863a..c584c8cd 100644 --- a/google/api_core/datetime_helpers.py +++ b/google/api_core/datetime_helpers.py @@ -170,7 +170,7 @@ def to_rfc3339(value, ignore_zone=True): datetime object is ignored and the datetime is treated as UTC. Returns: - str: The RFC3339 formated string representing the datetime. + str: The RFC3339 formatted string representing the datetime. """ if not ignore_zone and value.tzinfo is not None: # Convert to UTC and remove the time zone info. diff --git a/google/api_core/exceptions.py b/google/api_core/exceptions.py index aaba8791..35f2a6f8 100644 --- a/google/api_core/exceptions.py +++ b/google/api_core/exceptions.py @@ -73,7 +73,7 @@ class RetryError(GoogleAPIError): Args: message (str): The exception message. - cause (Exception): The last exception raised when retring the + cause (Exception): The last exception raised when retrying the function. """ diff --git a/google/api_core/extended_operation.py b/google/api_core/extended_operation.py index 092eba4e..79d47f0d 100644 --- a/google/api_core/extended_operation.py +++ b/google/api_core/extended_operation.py @@ -101,7 +101,7 @@ def __init__( # optional http_error_code = proto.Field(proto.INT32, number=3) # optional http_error_msg = proto.Field(proto.STRING, number=4) # - # the ExtendedOperation subclass would provide property overrrides that map + # the ExtendedOperation subclass would provide property overrides that map # to these (poorly named) fields. @property def name(self): diff --git a/google/api_core/future/polling.py b/google/api_core/future/polling.py index 6e6aa5d4..f1e2a188 100644 --- a/google/api_core/future/polling.py +++ b/google/api_core/future/polling.py @@ -68,7 +68,7 @@ class PollingFuture(base.Future): The :meth:`done` method should be implemented by subclasses. The polling behavior will repeatedly call ``done`` until it returns True. - The actuall polling logic is encapsulated in :meth:`result` method. See + The actual polling logic is encapsulated in :meth:`result` method. See documentation for that method for details on how polling works. .. note:: @@ -82,7 +82,7 @@ class PollingFuture(base.Future): ``timeout`` argument is specified in :meth:`result` method it will override the ``polling.timeout`` property. retry (google.api_core.retry.Retry): DEPRECATED use ``polling`` instead. - If set, it will override ``polling`` paremeter for backward + If set, it will override ``polling`` parameter for backward compatibility. """ @@ -224,8 +224,8 @@ class documentation for the proper definition of timeout and deadline to set this parameter explicitly. If ``polling`` is provided (i.e. ``polling is not None``), it will be used - to controll the overall polling behavior and ``polling.timeout`` will - controll Polling Timeout unless it is overridden by ``timeout`` parameter + to control the overall polling behavior and ``polling.timeout`` will + control Polling Timeout unless it is overridden by ``timeout`` parameter as described above. If not provided, the``polling`` parameter specified during construction of this future (the ``polling`` argument in the constructor) will be used instead. Note: since the ``timeout`` argument may diff --git a/google/api_core/gapic_v1/client_info.py b/google/api_core/gapic_v1/client_info.py index fab0f542..2de1be7f 100644 --- a/google/api_core/gapic_v1/client_info.py +++ b/google/api_core/gapic_v1/client_info.py @@ -36,7 +36,7 @@ class ClientInfo(client_info.ClientInfo): ``'3.9.6'``. grpc_version (Optional[str]): The gRPC library version. api_core_version (str): The google-api-core library version. - gapic_version (Optional[str]): The sversion of gapic-generated client + gapic_version (Optional[str]): The version of gapic-generated client library, if the library was generated by gapic. client_library_version (Optional[str]): The version of the client library, generally used if the client library was not generated diff --git a/google/api_core/general_helpers.py b/google/api_core/general_helpers.py index fba78026..a6af45b7 100644 --- a/google/api_core/general_helpers.py +++ b/google/api_core/general_helpers.py @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This import for backward compatibiltiy only. +# This import for backward compatibility only. from functools import wraps # noqa: F401 pragma: NO COVER diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index e02bc199..78a61746 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -468,7 +468,7 @@ def get_operation( Returns: google.longrunning.operations_pb2.Operation: This resource represents a long- - unning operation that is the result of a + running operation that is the result of a network API call. """ diff --git a/google/api_core/operations_v1/operations_client_config.py b/google/api_core/operations_v1/operations_client_config.py index 70cfd70a..3ad3548c 100644 --- a/google/api_core/operations_v1/operations_client_config.py +++ b/google/api_core/operations_v1/operations_client_config.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""gapic configuration for the googe.longrunning.operations client.""" +"""gapic configuration for the google.longrunning.operations client.""" # DEPRECATED: retry and timeout classes are instantiated directly config = { diff --git a/google/api_core/operations_v1/transports/rest.py b/google/api_core/operations_v1/transports/rest.py index bb6cd99c..bb9000f4 100644 --- a/google/api_core/operations_v1/transports/rest.py +++ b/google/api_core/operations_v1/transports/rest.py @@ -108,7 +108,7 @@ def __init__( "https", but for testing or local servers, "http" can be specified. http_options: a dictionary of http_options for transcoding, to override - the defaults from operatons.proto. Each method has an entry + the defaults from operations.proto. Each method has an entry with the corresponding http rules as value. path_prefix: path prefix (usually represents API version). Set to "v1" by default. @@ -246,7 +246,7 @@ def _get_operation( Returns: ~.operations_pb2.Operation: This resource represents a long- - unning operation that is the result of a + running operation that is the result of a network API call. """ diff --git a/google/api_core/protobuf_helpers.py b/google/api_core/protobuf_helpers.py index 896e89c1..f1abf068 100644 --- a/google/api_core/protobuf_helpers.py +++ b/google/api_core/protobuf_helpers.py @@ -288,10 +288,10 @@ def field_mask(original, modified): Args: original (~google.protobuf.message.Message): the original message. - If set to None, this field will be interpretted as an empty + If set to None, this field will be interpreted as an empty message. modified (~google.protobuf.message.Message): the modified message. - If set to None, this field will be interpretted as an empty + If set to None, this field will be interpreted as an empty message. Returns: diff --git a/google/api_core/retry.py b/google/api_core/retry.py index f9207a12..df1e65e0 100644 --- a/google/api_core/retry.py +++ b/google/api_core/retry.py @@ -16,7 +16,7 @@ The :class:`Retry` decorator can be used to retry functions that raise exceptions using exponential backoff. Because a exponential sleep algorithm is -used, the retry is limited by a `deadline`. The deadline is the maxmimum amount +used, the retry is limited by a `deadline`. The deadline is the maximum amount of time a method can block. This is used instead of total number of retries because it is difficult to ascertain the amount of time a function can block when using total number of retries and exponential backoff. @@ -265,7 +265,7 @@ class Retry(object): RPC Timeout: a value supplied by the client to the server so that the server side knows the maximum amount of time it is expected to - spend handling that specifc RPC. For example, in the case of gRPC transport, + spend handling that specific RPC. For example, in the case of gRPC transport, RPC Timeout is represented by setting "grpc-timeout" header in the HTTP2 request. The `timeout` property of this class normally never represents the RPC Timeout as it is handled separately by the ``google.api_core.timeout`` @@ -285,7 +285,7 @@ class Retry(object): With the actual timeout types being defined above, the client libraries often refer to just Timeout without clarifying which type specifically - that is. In that case the actual timeout type (sometimes also refered to as + that is. In that case the actual timeout type (sometimes also referred to as Logical Timeout) can be determined from the context. If it is a unary rpc call (i.e. a regular one) Timeout usually stands for the RPC Timeout (if provided directly as a standalone value) or Retry Timeout (if provided as diff --git a/google/api_core/retry_async.py b/google/api_core/retry_async.py index 81698838..739e88d9 100644 --- a/google/api_core/retry_async.py +++ b/google/api_core/retry_async.py @@ -169,7 +169,7 @@ class AsyncRetry: if the given exception is retryable. initial (float): The minimum a,out of time to delay in seconds. This must be greater than 0. - maximum (float): The maximum amout of time to delay in seconds. + maximum (float): The maximum amount of time to delay in seconds. multiplier (float): The multiplier applied to the delay. timeout (float): How long to keep retrying in seconds. on_error (Callable[Exception]): A function to call while processing @@ -287,9 +287,9 @@ def with_delay(self, initial=None, maximum=None, multiplier=None): """Return a copy of this retry with the given delay options. Args: - initial (float): The minimum amout of time to delay. This must + initial (float): The minimum amount of time to delay. This must be greater than 0. - maximum (float): The maximum amout of time to delay. + maximum (float): The maximum amount of time to delay. multiplier (float): The multiplier applied to the delay. Returns: diff --git a/google/api_core/timeout.py b/google/api_core/timeout.py index 3546d540..868e3e9f 100644 --- a/google/api_core/timeout.py +++ b/google/api_core/timeout.py @@ -220,9 +220,9 @@ class ExponentialTimeout(object): deadline (Optional[float]): The overall deadline across all invocations. This is used to prevent a very large calculated timeout from pushing the overall execution time over the deadline. - This is especially useful in conjuction with + This is especially useful in conjunction with :mod:`google.api_core.retry`. If ``None``, the timeouts will not - be adjusted to accomodate an overall deadline. + be adjusted to accommodate an overall deadline. """ def __init__( @@ -238,7 +238,7 @@ def __init__( self._deadline = deadline def with_deadline(self, deadline): - """Return a copy of this teimout with the given deadline. + """Return a copy of this timeout with the given deadline. Args: deadline (float): The overall deadline across all invocations. diff --git a/tests/asyncio/test_grpc_helpers_async.py b/tests/asyncio/test_grpc_helpers_async.py index 2f8f3460..33ce8212 100644 --- a/tests/asyncio/test_grpc_helpers_async.py +++ b/tests/asyncio/test_grpc_helpers_async.py @@ -280,7 +280,7 @@ def test_wrap_errors_streaming(wrap_stream_errors): @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.aio.secure_channel") def test_create_channel_implicit(grpc_secure_channel, default, composite_creds_call): @@ -305,7 +305,7 @@ def test_create_channel_implicit(grpc_secure_channel, default, composite_creds_c @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.aio.secure_channel") def test_create_channel_implicit_with_default_host( @@ -329,7 +329,7 @@ def test_create_channel_implicit_with_default_host( @mock.patch("grpc.composite_channel_credentials") @mock.patch( "google.auth.default", - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.aio.secure_channel") def test_create_channel_implicit_with_ssl_creds( @@ -351,7 +351,7 @@ def test_create_channel_implicit_with_ssl_creds( @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.aio.secure_channel") def test_create_channel_implicit_with_scopes( @@ -372,7 +372,7 @@ def test_create_channel_implicit_with_scopes( @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.aio.secure_channel") def test_create_channel_implicit_with_default_scopes( @@ -492,7 +492,7 @@ def test_create_channel_explicit_with_quota_project( autospec=True, return_value=(mock.sentinel.credentials, mock.sentinel.project), ) -def test_create_channnel_with_credentials_file( +def test_create_channel_with_credentials_file( load_credentials_from_file, grpc_secure_channel, composite_creds_call ): target = "example.com:443" diff --git a/tests/unit/gapic/test_method.py b/tests/unit/gapic/test_method.py index b1035413..03c2260d 100644 --- a/tests/unit/gapic/test_method.py +++ b/tests/unit/gapic/test_method.py @@ -121,7 +121,7 @@ def test_invoke_wrapped_method_with_metadata_as_none(): @mock.patch("time.sleep") -def test_wrap_method_with_default_retry_and_timeout(unusued_sleep): +def test_wrap_method_with_default_retry_and_timeout(unused_sleep): method = mock.Mock( spec=["__call__"], side_effect=[exceptions.InternalServerError(None), 42] ) @@ -139,7 +139,7 @@ def test_wrap_method_with_default_retry_and_timeout(unusued_sleep): @mock.patch("time.sleep") -def test_wrap_method_with_default_retry_and_timeout_using_sentinel(unusued_sleep): +def test_wrap_method_with_default_retry_and_timeout_using_sentinel(unused_sleep): method = mock.Mock( spec=["__call__"], side_effect=[exceptions.InternalServerError(None), 42] ) @@ -160,7 +160,7 @@ def test_wrap_method_with_default_retry_and_timeout_using_sentinel(unusued_sleep @mock.patch("time.sleep") -def test_wrap_method_with_overriding_retry_and_timeout(unusued_sleep): +def test_wrap_method_with_overriding_retry_and_timeout(unused_sleep): method = mock.Mock(spec=["__call__"], side_effect=[exceptions.NotFound(None), 42]) default_retry = retry.Retry() default_timeout = timeout.ConstantTimeout(60) diff --git a/tests/unit/operations_v1/test_operations_rest_client.py b/tests/unit/operations_v1/test_operations_rest_client.py index 149c463c..4ab4f1f7 100644 --- a/tests/unit/operations_v1/test_operations_rest_client.py +++ b/tests/unit/operations_v1/test_operations_rest_client.py @@ -592,7 +592,7 @@ def test_get_operation_rest_failure(): response_value.request = mock_request req.return_value = response_value with pytest.raises(core_exceptions.GoogleAPIError): - client.get_operation("sammple0/operations/sample1") + client.get_operation("sample0/operations/sample1") def test_delete_operation_rest( diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py index eb0b12d1..07a36817 100644 --- a/tests/unit/test_exceptions.py +++ b/tests/unit/test_exceptions.py @@ -355,7 +355,7 @@ def test_error_details_from_grpc_response(): status.details.append(status_br_detail) status.details.append(status_ei_detail) - # Actualy error doesn't matter as long as its grpc.Call, + # The actual error doesn't matter as long as its grpc.Call, # because from_call is mocked. error = mock.create_autospec(grpc.Call, instance=True) with mock.patch("grpc_status.rpc_status.from_call") as m: diff --git a/tests/unit/test_grpc_helpers.py b/tests/unit/test_grpc_helpers.py index 9fe938d6..a99dc280 100644 --- a/tests/unit/test_grpc_helpers.py +++ b/tests/unit/test_grpc_helpers.py @@ -222,7 +222,7 @@ def test_wrap_stream_prefetch_disabled(): callable_.assert_called_once_with(1, 2, three="four") -def test_wrap_stream_iterable_iterface(): +def test_wrap_stream_iterable_interface(): response_iter = mock.create_autospec(grpc.Call, instance=True) callable_ = mock.Mock(spec=["__call__"], return_value=response_iter) @@ -352,7 +352,7 @@ def test_wrap_errors_streaming(wrap_stream_errors): @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.secure_channel") def test_create_channel_implicit(grpc_secure_channel, default, composite_creds_call): @@ -410,7 +410,7 @@ def test_create_channel_implicit_with_default_host( @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.secure_channel") def test_create_channel_implicit_with_ssl_creds( @@ -437,7 +437,7 @@ def test_create_channel_implicit_with_ssl_creds( @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.secure_channel") def test_create_channel_implicit_with_scopes( @@ -462,7 +462,7 @@ def test_create_channel_implicit_with_scopes( @mock.patch( "google.auth.default", autospec=True, - return_value=(mock.sentinel.credentials, mock.sentinel.projet), + return_value=(mock.sentinel.credentials, mock.sentinel.project), ) @mock.patch("grpc.secure_channel") def test_create_channel_implicit_with_default_scopes(