Skip to content

Commit

Permalink
Merge pull request #15 from JJ11teen/dev
Browse files Browse the repository at this point in the history
Wrapper arg fix
  • Loading branch information
JJ11teen committed Aug 29, 2022
2 parents ea53eb6 + 73066af commit 27d0e3a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = cloud-mappings
version = 1.2.0
version = 1.2.1
author = Lucas Sargent
author_email = lucas.sargent@outlook.com
description = MutableMapping interfaces for common cloud storage providers
Expand Down
18 changes: 11 additions & 7 deletions src/cloudmappings/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import inspect

from .cloudstoragemapping import CloudMapping


def _parse_cloud_mapping_kwargs(kwargs: dict):
cloud_mapping_kwargs = dict(
sync_initially=kwargs.pop("sync_initially", True),
read_blindly=kwargs.pop("read_blindly", False),
read_blindly_default=kwargs.pop("read_blindly_default", None),
ordered_dumps_funcs=kwargs.pop("ordered_dumps_funcs", None),
ordered_loads_funcs=kwargs.pop("ordered_loads_funcs", None),
)
# We inspect the CloudMapping.__init__ function to determine what kwargs
# it understands, and pull those out. The remaining kwargs are then passed
# to the storage provider.
cloud_mapping_kwargs = {
n: kwargs.pop(n) if n in kwargs else p.default
for n, p in inspect.signature(CloudMapping.__init__).parameters.items()
if n not in ["self", "storage_provider"]
}
print(cloud_mapping_kwargs)
return cloud_mapping_kwargs, kwargs


Expand Down
8 changes: 8 additions & 0 deletions tests/tests/5_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def test_azure_blob_mapping(self, azure_blob_storage_account_url, test_container
container_name=test_container_name,
sync_initially=False,
read_blindly=True,
read_blindly_error=False,
read_blindly_default=None,
)
assert len(cm.etags) == 0
assert cm.read_blindly == True
Expand All @@ -32,6 +34,8 @@ def test_azure_table_mapping(self, azure_table_storage_connection_string, test_c
table_name=test_container_name,
sync_initially=False,
read_blindly=True,
read_blindly_error=False,
read_blindly_default=None,
)
assert len(cm.etags) == 0
assert cm.read_blindly == True
Expand All @@ -51,6 +55,8 @@ def test_gcp_storage_mapping(self, gcp_storage_project, test_container_name):
bucket_name=test_container_name,
sync_initially=False,
read_blindly=True,
read_blindly_error=False,
read_blindly_default=None,
)
assert len(cm.etags) == 0
assert cm.read_blindly == True
Expand All @@ -69,6 +75,8 @@ def test_aws_s3_mapping(self, test_container_name):
bucket_name=test_container_name,
sync_initially=False,
read_blindly=True,
read_blindly_error=False,
read_blindly_default=None,
)
assert len(cm.etags) == 0
assert cm.read_blindly == True
Expand Down

0 comments on commit 27d0e3a

Please sign in to comment.