| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7073be1 commit c9846c9
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,8 +84,7 @@ def generate_requests( | |||
| 84 | 84 | break | |
| 85 | 85 | ||
| 86 | 86 | checksummed_data = storage_type.ChecksummedData(content=chunk) | |
| 87 | - checksum = google_crc32c.Checksum(chunk) | ||
| 88 | - checksummed_data.crc32c = int.from_bytes(checksum.digest(), "big") | ||
| 87 | + checksummed_data.crc32c = google_crc32c.value(chunk) | ||
| 89 | 88 | ||
| 90 | 89 | request = storage_type.BidiWriteObjectRequest( | |
| 91 | 90 | write_offset=write_state.bytes_sent, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ | |||
| 17 | 17 | import unittest | |
| 18 | 18 | ||
| 19 | 19 | from google.api_core import exceptions | |
| 20 | - from google_crc32c import Checksum | ||
| 20 | + import google_crc32c | ||
| 21 | 21 | ||
| 22 | 22 | from google.cloud import _storage_v2 as storage_v2 | |
| 23 | 23 | from google.cloud._storage_v2.types.storage import BidiReadObjectRedirectedError | |
@@ -77,8 +77,7 @@ def _create_response( | |||
| 77 | 77 | checksummed_data = None | |
| 78 | 78 | if content is not None: | |
| 79 | 79 | if crc is None: | |
| 80 | - c = Checksum(content) | ||
| 81 | - crc = int.from_bytes(c.digest(), "big") | ||
| 80 | + crc = google_crc32c.value(content) | ||
| 82 | 81 | checksummed_data = storage_v2.ChecksummedData(content=content, crc32c=crc) | |
| 83 | 82 | ||
| 84 | 83 | read_range = None | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -125,8 +125,7 @@ def test_generate_requests_checksum_verification(self, strategy): | |||
| 125 | 125 | ||
| 126 | 126 | requests = strategy.generate_requests(state) | |
| 127 | 127 | ||
| 128 | - expected_crc = google_crc32c.Checksum(chunk_data).digest() | ||
| 129 | - expected_int = int.from_bytes(expected_crc, "big") | ||
| 128 | + expected_int = google_crc32c.value(chunk_data) | ||
| 130 | 129 | assert requests[0].checksummed_data.crc32c == expected_int | |
| 131 | 130 | ||
| 132 | 131 | def test_generate_requests_flush_logic_exact_interval(self, strategy): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | import pytest | |
| 21 | 21 | from google.api_core import exceptions | |
| 22 | - from google_crc32c import Checksum | ||
| 22 | + import google_crc32c | ||
| 23 | 23 | ||
| 24 | 24 | from google.cloud import _storage_v2 | |
| 25 | 25 | from google.cloud.storage.asyncio import async_read_object_stream | |
@@ -106,11 +106,8 @@ async def test_download_ranges_via_async_gather( | |||
| 106 | 106 | self, mock_cls_async_read_object_stream, mock_random_int | |
| 107 | 107 | ): | |
| 108 | 108 | data = b"these_are_18_chars" | |
| 109 | - crc32c = Checksum(data).digest() | ||
| 110 | - crc32c_int = int.from_bytes(crc32c, "big") | ||
| 111 | - crc32c_checksum_for_data_slice = int.from_bytes( | ||
| 112 | - Checksum(data[10:16]).digest(), "big" | ||
| 113 | - ) | ||
| 109 | + crc32c_int = google_crc32c.value(data) | ||
| 110 | + crc32c_checksum_for_data_slice = google_crc32c.value(data[10:16]) | ||
| 114 | 111 | ||
| 115 | 112 | mock_mrd, _ = await self._make_mock_mrd(mock_cls_async_read_object_stream) | |
| 116 | 113 | mock_random_int.side_effect = [456, 91011] | |
@@ -187,8 +184,7 @@ async def test_download_ranges( | |||
| 187 | 184 | ): | |
| 188 | 185 | # Arrange | |
| 189 | 186 | data = b"these_are_18_chars" | |
| 190 | - crc32c = Checksum(data).digest() | ||
| 191 | - crc32c_int = int.from_bytes(crc32c, "big") | ||
| 187 | + crc32c_int = google_crc32c.value(data) | ||
| 192 | 188 | ||
| 193 | 189 | mock_mrd, _ = await self._make_mock_mrd(mock_cls_async_read_object_stream) | |
| 194 | 190 | mock_random_int.side_effect = [456] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments