Skip to content

Commit a18f028

Browse files
Directly use assignment instead of dict.update()
Co-authored-by: Angus Hollands <[email protected]>
1 parent 1395319 commit a18f028

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jupyterhub/files/hub/jupyterhub_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def camelCaseify(s):
337337
"subPath": file_key,
338338
"name": "files",
339339
}
340-
volume_mounts.update({f"{idx}-files": volume_mount})
340+
volume_mounts[f"{idx}-files"] = volume_mount
341341

342342
# Inject extraVolumes / extraVolumeMounts
343343
extra_volumes = get_config("singleuser.storage.extraVolumes", default={})
@@ -346,19 +346,19 @@ def camelCaseify(s):
346346
volumes.update[key] = volume
347347
elif isinstance(extra_volumes, list):
348348
for volume in extra_volumes:
349-
volumes.update({volume["name"]: volume})
349+
volumes[volume["name"]] = volume
350350

351351
extra_volume_mounts = get_config("singleuser.storage.extraVolumeMounts", default={})
352352
if isinstance(extra_volume_mounts, dict):
353353
for key, volume_mount in extra_volume_mounts.items():
354-
volume_mounts.update({key: volume_mount})
354+
volume_mounts[key] = volume_mount
355355
elif isinstance(extra_volume_mounts, list):
356356
# If extraVolumeMounts is a list, we need to add them to the volume_mounts
357357
# dictionary with a unique key.
358358
# Since volume mount's name is not guaranteed to be unique, we use the index
359359
# as part of the key.
360360
for idx, volume_mount in enumerate(extra_volume_mounts):
361-
volume_mounts.update({f"{idx}-{volume_mount['name']}": volume_mount})
361+
volume_mounts[f"{idx}-{volume_mount['name']}"] = volume_mount
362362

363363
c.KubeSpawner.volumes = volumes
364364
c.KubeSpawner.volume_mounts = volume_mounts

0 commit comments

Comments
 (0)