Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/avro/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ def new_decoder(b: bytes) -> BinaryDecoder:
except ModuleNotFoundError:
import warnings

warnings.warn("Falling back to pure Python Avro decoder, missing Cython implementation")
warnings.warn("Falling back to pure Python Avro decoder, missing Cython implementation", stacklevel=2)

return StreamingBinaryDecoder(b)
2 changes: 1 addition & 1 deletion pyiceberg/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def _infer_file_io_from_scheme(path: str, properties: Properties) -> FileIO | No
if file_io := _import_file_io(file_io_path, properties):
return file_io
else:
warnings.warn(f"No preferred file implementation for scheme: {parsed_url.scheme}")
warnings.warn(f"No preferred file implementation for scheme: {parsed_url.scheme}", stacklevel=2)
return None


Expand Down
4 changes: 2 additions & 2 deletions pyiceberg/io/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _import_retry_strategy(impl: str) -> S3RetryStrategy | None:
class_ = getattr(module, class_name)
return class_()
except (ModuleNotFoundError, AttributeError):
warnings.warn(f"Could not initialize S3 retry strategy: {impl}")
warnings.warn(f"Could not initialize S3 retry strategy: {impl}", stacklevel=2)
return None


Expand Down Expand Up @@ -2768,7 +2768,7 @@ def _get_parquet_writer_kwargs(table_properties: Properties) -> Dict[str, Any]:
f"{TableProperties.PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX}.*",
]:
if unsupported_keys := fnmatch.filter(table_properties, key_pattern):
warnings.warn(f"Parquet writer option(s) {unsupported_keys} not implemented")
warnings.warn(f"Parquet writer option(s) {unsupported_keys} not implemented", stacklevel=2)

compression_codec = table_properties.get(TableProperties.PARQUET_COMPRESSION, TableProperties.PARQUET_COMPRESSION_DEFAULT)
compression_level = property_as_int(
Expand Down
8 changes: 4 additions & 4 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def delete(
self.table_metadata.properties.get(TableProperties.DELETE_MODE, TableProperties.DELETE_MODE_DEFAULT)
== TableProperties.DELETE_MODE_MERGE_ON_READ
):
warnings.warn("Merge on read is not yet supported, falling back to copy-on-write")
warnings.warn("Merge on read is not yet supported, falling back to copy-on-write", stacklevel=2)

if isinstance(delete_filter, str):
delete_filter = _parse_row_filter(delete_filter)
Expand Down Expand Up @@ -731,7 +731,7 @@ def delete(
overwrite_snapshot.append_data_file(replaced_data_file)

if not delete_snapshot.files_affected and not delete_snapshot.rewrites_needed:
warnings.warn("Delete operation did not match any records")
warnings.warn("Delete operation did not match any records", stacklevel=2)

def upsert(
self,
Expand Down Expand Up @@ -1502,7 +1502,7 @@ def _do_commit(self, updates: Tuple[TableUpdate, ...], requirements: Tuple[Table
try:
self.catalog._delete_old_metadata(self.io, self.metadata, response.metadata)
except Exception as e:
warnings.warn(f"Failed to delete old metadata after commit: {e}")
warnings.warn(f"Failed to delete old metadata after commit: {e}", stacklevel=2)

self.metadata = response.metadata
self.metadata_location = response.metadata_location
Expand Down Expand Up @@ -1728,7 +1728,7 @@ def projection(self) -> Schema:
schema for schema in self.table_metadata.schemas if schema.schema_id == snapshot.schema_id
)
except StopIteration:
warnings.warn(f"Metadata does not contain schema with id: {snapshot.schema_id}")
warnings.warn(f"Metadata does not contain schema with id: {snapshot.schema_id}", stacklevel=2)
else:
raise ValueError(f"Snapshot not found: {self.snapshot_id}")

Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/table/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Summary(IcebergBaseModel, Mapping[str, str]):

def __init__(self, operation: Operation | None = None, **data: Any) -> None:
if operation is None:
warnings.warn("Encountered invalid snapshot summary: operation is missing, defaulting to overwrite")
warnings.warn("Encountered invalid snapshot summary: operation is missing, defaulting to overwrite", stacklevel=2)
operation = Operation.OVERWRITE
super().__init__(operation=operation, **data)
self._additional_properties = data
Expand Down
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ select = [
]
ignore = [
"E501",
"B028",
"UP037",
"UP035",
"UP006"
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2804,7 +2804,7 @@ def test_pyarrow_io_multi_fs() -> None:
class SomeRetryStrategy(AwsDefaultS3RetryStrategy):
def __init__(self) -> None:
super().__init__()
warnings.warn("Initialized SomeRetryStrategy 👍")
warnings.warn("Initialized SomeRetryStrategy 👍", stacklevel=2)


def test_retry_strategy() -> None:
Expand Down