python: Replace None defaults with empty collections where appropriate.

Use read-only types (List ↦ Sequence, Dict ↦ Mapping, Set ↦
AbstractSet) to guard against accidental mutation of the default
value.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-06-12 18:34:01 -07:00
committed by Tim Abbott
parent cfcbf58cd1
commit 91a86c24f5
24 changed files with 101 additions and 119 deletions

View File

@@ -129,8 +129,7 @@ def send_bot_payload_message(bot: UserProfile, integration: WebhookIntegration,
data = ''
headers = get_requests_headers(integration.name, fixture_name)
if config.custom_headers:
headers.update(config.custom_headers)
headers.update(config.custom_headers)
if config.use_basic_auth:
credentials = base64.b64encode(f'{bot.email}:{bot.api_key}'.encode('utf8')).decode('utf8')
auth = f'basic {credentials}'
@@ -140,8 +139,7 @@ def send_bot_payload_message(bot: UserProfile, integration: WebhookIntegration,
stream = integration.stream_name or 'devel'
url = f"{bot.bot_owner.realm.uri}/{integration.url}"
params = {'api_key': bot.api_key, 'stream': stream}
if config.extra_params:
params.update(config.extra_params)
params.update(config.extra_params)
extra_args = {}
if not json_fixture and data: