|
42 | 42 | List, |
43 | 43 | Optional, |
44 | 44 | ) |
45 | | -from urllib.parse import urlparse |
46 | 45 |
|
47 | 46 | import boto3 |
48 | 47 | import pytest |
|
57 | 56 | GCS_PROJECT_ID, |
58 | 57 | GCS_TOKEN, |
59 | 58 | GCS_TOKEN_EXPIRES_AT_MS, |
60 | | - OutputFile, |
61 | | - OutputStream, |
62 | 59 | fsspec, |
63 | 60 | load_file_io, |
64 | 61 | ) |
|
88 | 85 | import pyarrow as pa |
89 | 86 | from moto.server import ThreadedMotoServer # type: ignore |
90 | 87 |
|
91 | | - from pyiceberg.io.pyarrow import PyArrowFile, PyArrowFileIO |
| 88 | + from pyiceberg.io.pyarrow import PyArrowFileIO |
92 | 89 |
|
93 | 90 |
|
94 | 91 | def pytest_collection_modifyitems(items: List[pytest.Item]) -> None: |
@@ -1456,40 +1453,6 @@ def simple_map() -> MapType: |
1456 | 1453 | return MapType(key_id=19, key_type=StringType(), value_id=25, value_type=DoubleType(), value_required=False) |
1457 | 1454 |
|
1458 | 1455 |
|
1459 | | -class LocalOutputFile(OutputFile): |
1460 | | - """An OutputFile implementation for local files (for test use only).""" |
1461 | | - |
1462 | | - def __init__(self, location: str) -> None: |
1463 | | - parsed_location = urlparse(location) # Create a ParseResult from the uri |
1464 | | - if ( |
1465 | | - parsed_location.scheme and parsed_location.scheme != "file" |
1466 | | - ): # Validate that an uri is provided with a scheme of `file` |
1467 | | - raise ValueError("LocalOutputFile location must have a scheme of `file`") |
1468 | | - elif parsed_location.netloc: |
1469 | | - raise ValueError(f"Network location is not allowed for LocalOutputFile: {parsed_location.netloc}") |
1470 | | - |
1471 | | - super().__init__(location=location) |
1472 | | - self._path = parsed_location.path |
1473 | | - |
1474 | | - def __len__(self) -> int: |
1475 | | - """Return the length of an instance of the LocalOutputFile class.""" |
1476 | | - return os.path.getsize(self._path) |
1477 | | - |
1478 | | - def exists(self) -> bool: |
1479 | | - return os.path.exists(self._path) |
1480 | | - |
1481 | | - def to_input_file(self) -> "PyArrowFile": |
1482 | | - from pyiceberg.io.pyarrow import PyArrowFileIO |
1483 | | - |
1484 | | - return PyArrowFileIO().new_input(location=self.location) |
1485 | | - |
1486 | | - def create(self, overwrite: bool = False) -> OutputStream: |
1487 | | - output_file = open(self._path, "wb" if overwrite else "xb") |
1488 | | - if not issubclass(type(output_file), OutputStream): |
1489 | | - raise TypeError("Object returned from LocalOutputFile.create(...) does not match the OutputStream protocol.") |
1490 | | - return output_file |
1491 | | - |
1492 | | - |
1493 | 1456 | @pytest.fixture(scope="session") |
1494 | 1457 | def generated_manifest_entry_file(avro_schema_manifest_entry: Dict[str, Any]) -> Generator[str, None, None]: |
1495 | 1458 | from fastavro import parse_schema, writer |
|
0 commit comments