Skip to content

Commit 34eaec6

Browse files
committed
only use positional arguments when preparing partially curried functions to avoid the possibility of conflicts when curried functions are used elsewhere
1 parent cc06c2c commit 34eaec6

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

src/dynamodb_encryption_sdk/encrypted/client.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,49 +70,49 @@ def __attrs_post_init__(self):
7070
)
7171
self._table_crypto_config = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
7272
crypto_config_from_cache,
73-
materials_provider=self._materials_provider,
74-
attribute_actions=self._attribute_actions,
75-
table_info_cache=self._table_info_cache
73+
self._materials_provider,
74+
self._attribute_actions,
75+
self._table_info_cache
7676
)
7777
self._item_crypto_config = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
7878
crypto_config_from_kwargs,
79-
fallback=self._table_crypto_config
79+
self._table_crypto_config
8080
)
8181
self.get_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
8282
decrypt_get_item,
83-
decrypt_method=decrypt_dynamodb_item,
84-
crypto_config_method=self._item_crypto_config,
85-
read_method=self._client.get_item
83+
decrypt_dynamodb_item,
84+
self._item_crypto_config,
85+
self._client.get_item
8686
)
8787
self.put_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
8888
encrypt_put_item,
89-
encrypt_method=encrypt_dynamodb_item,
90-
crypto_config_method=self._item_crypto_config,
91-
write_method=self._client.put_item
89+
encrypt_dynamodb_item,
90+
self._item_crypto_config,
91+
self._client.put_item
9292
)
9393
self.query = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
9494
decrypt_multi_get,
95-
decrypt_method=decrypt_dynamodb_item,
96-
crypto_config_method=self._item_crypto_config,
97-
read_method=self._client.query
95+
decrypt_dynamodb_item,
96+
self._item_crypto_config,
97+
self._client.query
9898
)
9999
self.scan = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
100100
decrypt_multi_get,
101-
decrypt_method=decrypt_dynamodb_item,
102-
crypto_config_method=self._item_crypto_config,
103-
read_method=self._client.scan
101+
decrypt_dynamodb_item,
102+
self._item_crypto_config,
103+
self._client.scan
104104
)
105105
self.batch_get_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
106106
decrypt_batch_get_item,
107-
decrypt_method=decrypt_dynamodb_item,
108-
crypto_config_method=self._table_crypto_config,
109-
read_method=self._client.batch_get_item
107+
decrypt_dynamodb_item,
108+
self._table_crypto_config,
109+
self._client.batch_get_item
110110
)
111111
self.batch_write_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
112112
encrypt_batch_write_item,
113-
encrypt_method=encrypt_dynamodb_item,
114-
crypto_config_method=self._table_crypto_config,
115-
write_method=self._client.batch_write_item
113+
encrypt_dynamodb_item,
114+
self._table_crypto_config,
115+
self._client.batch_write_item
116116
)
117117

118118
def __getattr__(self, name):

src/dynamodb_encryption_sdk/encrypted/resource.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ def __attrs_post_init__(self):
140140
)
141141
self._crypto_config = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
142142
crypto_config_from_cache,
143-
materials_provider=self._materials_provider,
144-
attribute_actions=self._attribute_actions,
145-
table_info_cache=self._table_info_cache
143+
self._materials_provider,
144+
self._attribute_actions,
145+
self._table_info_cache
146146
)
147147
self.tables = EncryptedTablesCollectionManager( # attrs confuses pylint: disable=attribute-defined-outside-init
148148
collection=self._resource.tables,
@@ -152,15 +152,15 @@ def __attrs_post_init__(self):
152152
)
153153
self.batch_get_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
154154
decrypt_batch_get_item,
155-
decrypt_method=decrypt_python_item,
156-
crypto_config_method=self._crypto_config,
157-
read_method=self._resource.batch_get_item
155+
decrypt_python_item,
156+
self._crypto_config,
157+
self._resource.batch_get_item
158158
)
159159
self.batch_write_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
160160
encrypt_batch_write_item,
161-
encrypt_method=encrypt_python_item,
162-
crypto_config_method=self._crypto_config,
163-
write_method=self._resource.batch_write_item
161+
encrypt_python_item,
162+
self._crypto_config,
163+
self._resource.batch_write_item
164164
)
165165

166166
def __getattr__(self, name):

src/dynamodb_encryption_sdk/encrypted/table.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,36 @@ def __attrs_post_init__(self):
8888

8989
self._crypto_config = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
9090
crypto_config_from_kwargs,
91-
fallback=partial(
91+
partial(
9292
crypto_config_from_table_info,
93-
materials_provider=self._materials_provider,
94-
attribute_actions=self._attribute_actions,
95-
table_info=self._table_info
93+
self._materials_provider,
94+
self._attribute_actions,
95+
self._table_info
9696
)
9797
)
9898
self.get_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
9999
decrypt_get_item,
100-
decrypt_method=decrypt_python_item,
101-
crypto_config_method=self._crypto_config,
102-
read_method=self._table.get_item
100+
decrypt_python_item,
101+
self._crypto_config,
102+
self._table.get_item
103103
)
104104
self.put_item = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
105105
encrypt_put_item,
106-
encrypt_method=encrypt_python_item,
107-
crypto_config_method=self._crypto_config,
108-
write_method=self._table.put_item
106+
encrypt_python_item,
107+
self._crypto_config,
108+
self._table.put_item
109109
)
110110
self.query = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
111111
decrypt_multi_get,
112-
decrypt_method=decrypt_python_item,
113-
crypto_config_method=self._crypto_config,
114-
read_method=self._table.query
112+
decrypt_python_item,
113+
self._crypto_config,
114+
self._table.query
115115
)
116116
self.scan = partial( # attrs confuses pylint: disable=attribute-defined-outside-init
117117
decrypt_multi_get,
118-
decrypt_method=decrypt_python_item,
119-
crypto_config_method=self._crypto_config,
120-
read_method=self._table.scan
118+
decrypt_python_item,
119+
self._crypto_config,
120+
self._table.scan
121121
)
122122

123123
def __getattr__(self, name):

0 commit comments

Comments
 (0)