| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,41 +1,11 @@ | |||
| 1 | - # Copyright 2025 Google LLC | ||
| 2 | - # | ||
| 3 | - # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | - # you may not use this file except in compliance with the License. | ||
| 5 | - # You may obtain a copy of the License at | ||
| 6 | - # | ||
| 7 | - # https://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | - # | ||
| 9 | - # Unless required by applicable law or agreed to in writing, software | ||
| 10 | - # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | - # See the License for the specific language governing permissions and | ||
| 13 | - # limitations under the License. | ||
| 1 | + import warnings | ||
| 14 | 2 | ||
| 15 | - import google_crc32c | ||
| 3 | + # Import everything from the new stable module | ||
| 4 | + from google.cloud.storage.asyncio._utils import * # noqa | ||
| 16 | 5 | ||
| 17 | - from google.api_core import exceptions | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - def raise_if_no_fast_crc32c(): | ||
| 21 | - """Check if the C-accelerated version of google-crc32c is available. | ||
| 22 | - | ||
| 23 | - If not, raise an error to prevent silent performance degradation. | ||
| 24 | - | ||
| 25 | - raises google.api_core.exceptions.FailedPrecondition: If the C extension is not available. | ||
| 26 | - returns: True if the C extension is available. | ||
| 27 | - rtype: bool | ||
| 28 | - | ||
| 29 | - """ | ||
| 30 | - if google_crc32c.implementation != "c": | ||
| 31 | - raise exceptions.FailedPrecondition( | ||
| 32 | - "The google-crc32c package is not installed with C support. " | ||
| 33 | - "C extension is required for faster data integrity checks." | ||
| 34 | - "For more information, see https://github.com/googleapis/python-crc32c." | ||
| 35 | - ) | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - def update_write_handle_if_exists(obj, response): | ||
| 39 | - """Update the write_handle attribute of an object if it exists in the response.""" | ||
| 40 | - if hasattr(response, "write_handle") and response.write_handle is not None: | ||
| 41 | - obj.write_handle = response.write_handle | ||
| 6 | + warnings.warn( | ||
| 7 | + "google.cloud.storage._experimental.asyncio._utils has been moved to google.cloud.storage.asyncio._utils. " | ||
| 8 | + "Please update your imports.", | ||
| 9 | + DeprecationWarning, | ||
| 10 | + stacklevel=2, | ||
| 11 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,67 +1,11 @@ | |||
| 1 | - # Copyright 2025 Google LLC | ||
| 2 | - # | ||
| 3 | - # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | - # you may not use this file except in compliance with the License. | ||
| 5 | - # You may obtain a copy of the License at | ||
| 6 | - # | ||
| 7 | - # http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | - # | ||
| 9 | - # Unless required by applicable law or agreed to in writing, software | ||
| 10 | - # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | - # See the License for the specific language governing permissions and | ||
| 13 | - # limitations under the License. | ||
| 1 | + import warnings | ||
| 14 | 2 | ||
| 15 | - import abc | ||
| 16 | - from typing import Any, Optional | ||
| 3 | + # Import everything from the new stable module | ||
| 4 | + from google.cloud.storage.asyncio.async_abstract_object_stream import * # noqa | ||
| 17 | 5 | ||
| 18 | - | ||
| 19 | - class _AsyncAbstractObjectStream(abc.ABC): | ||
| 20 | - """Abstract base class to represent gRPC bidi-stream for GCS ``Object``. | ||
| 21 | - | ||
| 22 | - Concrete implementation of this class could be ``_AsyncReadObjectStream`` | ||
| 23 | - or ``_AsyncWriteObjectStream``. | ||
| 24 | - | ||
| 25 | - :type bucket_name: str | ||
| 26 | - :param bucket_name: (Optional) The name of the bucket containing the object. | ||
| 27 | - | ||
| 28 | - :type object_name: str | ||
| 29 | - :param object_name: (Optional) The name of the object. | ||
| 30 | - | ||
| 31 | - :type generation_number: int | ||
| 32 | - :param generation_number: (Optional) If present, selects a specific revision of | ||
| 33 | - this object. | ||
| 34 | - | ||
| 35 | - :type handle: Any | ||
| 36 | - :param handle: (Optional) The handle for the object, could be read_handle or | ||
| 37 | - write_handle, based on how the stream is used. | ||
| 38 | - """ | ||
| 39 | - | ||
| 40 | - def __init__( | ||
| 41 | - self, | ||
| 42 | - bucket_name: str, | ||
| 43 | - object_name: str, | ||
| 44 | - generation_number: Optional[int] = None, | ||
| 45 | - handle: Optional[Any] = None, | ||
| 46 | - ) -> None: | ||
| 47 | - super().__init__() | ||
| 48 | - self.bucket_name: str = bucket_name | ||
| 49 | - self.object_name: str = object_name | ||
| 50 | - self.generation_number: Optional[int] = generation_number | ||
| 51 | - self.handle: Optional[Any] = handle | ||
| 52 | - | ||
| 53 | - @abc.abstractmethod | ||
| 54 | - async def open(self) -> None: | ||
| 55 | - pass | ||
| 56 | - | ||
| 57 | - @abc.abstractmethod | ||
| 58 | - async def close(self) -> None: | ||
| 59 | - pass | ||
| 60 | - | ||
| 61 | - @abc.abstractmethod | ||
| 62 | - async def send(self, protobuf: Any) -> None: | ||
| 63 | - pass | ||
| 64 | - | ||
| 65 | - @abc.abstractmethod | ||
| 66 | - async def recv(self) -> Any: | ||
| 67 | - pass | ||
| 6 | + warnings.warn( | ||
| 7 | + "google.cloud.storage._experimental.asyncio.async_abstract_object_stream has been moved to google.cloud.storage.asyncio.async_abstract_object_stream. " | ||
| 8 | + "Please update your imports.", | ||
| 9 | + DeprecationWarning, | ||
| 10 | + stacklevel=2, | ||
| 11 | + ) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments