mirror of
https://github.com/clearml/clearml
synced 2025-02-12 07:35:08 +00:00
Fix Task.connect_configuration()
removes trailing +
sign from configuration key
This commit is contained in:
parent
13f11a68be
commit
c394046a2d
@ -61,6 +61,23 @@ def config_dict_to_text(config):
|
|||||||
try:
|
try:
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
|
def raise_on_special_key(config_):
|
||||||
|
if not isinstance(config_, dict):
|
||||||
|
return
|
||||||
|
special_chars = "$}[]:=+#`^?!@*&."
|
||||||
|
for key in config_.keys():
|
||||||
|
if not isinstance(key, str):
|
||||||
|
continue
|
||||||
|
if any(key_char in special_chars for key_char in key):
|
||||||
|
raise ValueError(
|
||||||
|
"Configuration dictionary keys cannot contain any of the following characters: {}".format(
|
||||||
|
special_chars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for val in config_.values():
|
||||||
|
raise_on_special_key(val)
|
||||||
|
# will fall back to json+pyhocon
|
||||||
|
raise_on_special_key(config)
|
||||||
text = HOCONConverter.to_hocon(ConfigFactory.from_dict(hocon_quote_key(config)))
|
text = HOCONConverter.to_hocon(ConfigFactory.from_dict(hocon_quote_key(config)))
|
||||||
except Exception:
|
except Exception:
|
||||||
# fallback json+pyhocon
|
# fallback json+pyhocon
|
||||||
|
Loading…
Reference in New Issue
Block a user