Skip to content

Commit

Permalink
Remove py3.9 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
hfern committed Jan 15, 2025
1 parent d7f9ce5 commit 41d6514
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion kombu/asynchronous/aws/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def __init__(self, sqs_connection, http_client=None,
**http_client_params)

def make_request(self, operation, params_, path, verb, callback=None, protocol_params=None):
params = params_.copy() | (protocol_params or {}).get('query', {})
params = params_.copy()
params.update((protocol_params or {}).get('query', {}))
if operation:
params['Action'] = operation
signer = self.sqs_connection._request_signer
Expand Down
2 changes: 1 addition & 1 deletion kombu/asynchronous/aws/sqs/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def make_request(self, operation_name, params, queue_url, verb, callback=None, p

service_model = self.sqs_connection.meta.service_model
protocol = service_model.protocol
all_params = (params or {}) | protocol_params.get(protocol, {})
all_params = {**(params or {}), **protocol_params.get(protocol, {})}

if protocol == 'query':
request = self._create_query_request(
Expand Down
9 changes: 5 additions & 4 deletions kombu/transport/SQS.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,11 @@ def asynsqs(self, queue=None):
"'predefined_queues'."
).format(queue))
q = self.predefined_queues[queue]
c = self._predefined_queue_async_clients[queue] = AsyncSQSConnection(
sqs_connection=self.sqs(queue=queue),
region=q.get('region', self.region),
fetch_message_attributes=self.fetch_message_attributes,
c = self._predefined_queue_async_clients[queue] = \
AsyncSQSConnection(
sqs_connection=self.sqs(queue=queue),
region=q.get('region', self.region),
fetch_message_attributes=self.fetch_message_attributes,
)
return c

Expand Down
4 changes: 2 additions & 2 deletions t/unit/asynchronous/aws/sqs/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_make_request__with_query_protocol(self):
queue_url = f'{SQS_URL}/123456789012/celery-test'
verb = 'POST'

expect_params = params | {'AttributeName.1': 'ApproximateReceiveCount'}
expect_params = {**params, 'AttributeName.1': 'ApproximateReceiveCount'}

self.x.make_request(operation, params, queue_url, verb, protocol_params=pparams)
self.x._create_query_request.assert_called_with(
Expand Down Expand Up @@ -186,7 +186,7 @@ def test_make_request__with_json_protocol(self):

queue_url = f'{SQS_URL}/123456789012/celery-test'
verb = 'POST'
expect_params = params | {'AttributeNames': ['ApproximateReceiveCount']}
expect_params = {**params, 'AttributeNames': ['ApproximateReceiveCount']}

self.x.make_request(operation, params, queue_url, verb, protocol_params=pparams)
self.x._create_json_request.assert_called_with(
Expand Down

0 comments on commit 41d6514

Please sign in to comment.