This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-4263-62cfd8bb4c8eefb750166ccd6c14f63bfadc2eee in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
commit c78e18e737a61cca43ce26e51c21d36eb1376833 Author: prabhleen2317 <[email protected]> AuthorDate: Mon Nov 2 08:50:24 2026 +0000 Remove redundant .keys() in dict membership and iteration (#4263) `x in d.keys()` and `reversed(d.keys())` behave identically to operating on the dict directly, dropping two unnecessary dict-view allocations. No behavior change. --- pyiceberg/catalog/dynamodb.py | 2 +- pyiceberg/table/update/snapshot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyiceberg/catalog/dynamodb.py b/pyiceberg/catalog/dynamodb.py index 220313ab7..62a4da510 100644 --- a/pyiceberg/catalog/dynamodb.py +++ b/pyiceberg/catalog/dynamodb.py @@ -704,7 +704,7 @@ class DynamoDbCatalog(MetastoreCatalog): DYNAMODB_COL_NAMESPACE, DYNAMODB_COL_CREATED_AT, ]: - if prop not in table_dict.keys(): + if prop not in table_dict: raise NoSuchPropertyException(f"Iceberg required property {prop} is missing: {dynamo_table_item}") table_type = table_dict[_add_property_prefix(TABLE_TYPE)] diff --git a/pyiceberg/table/update/snapshot.py b/pyiceberg/table/update/snapshot.py index 8feebb990..5ca3eb7a7 100644 --- a/pyiceberg/table/update/snapshot.py +++ b/pyiceberg/table/update/snapshot.py @@ -1008,7 +1008,7 @@ class _ManifestMergeManager(Generic[U]): groups = self._group_by_spec(manifests) merged_manifests = [] - for spec_id in reversed(groups.keys()): + for spec_id in reversed(groups): merged_manifests.extend(self._merge_group(first_manifest, spec_id, groups[spec_id])) return merged_manifests
