-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from 2i2c-org/host_config
Allow setting arbitrary host config and env variables on launched containers
- Loading branch information
Showing
2 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# From https://github.com/jupyter-server/jupyter_server/blob/fc0ac3236fdd92778ea765db6e8982212c8389ee/jupyter_server/config_manager.py#L14 | ||
def recursive_update(target: dict, new: dict) -> None: | ||
""" | ||
Recursively update one dictionary in-place using another. | ||
None values will delete their keys. | ||
""" | ||
for k, v in new.items(): | ||
if isinstance(v, dict): | ||
if k not in target: | ||
target[k] = {} | ||
recursive_update(target[k], v) | ||
|
||
elif v is None: | ||
target.pop(k, None) | ||
|
||
else: | ||
target[k] = v |