Enforce string-formatting with f-strings (#10980)
* First third * Styling and fix mistake * Quality * All the rest * Treat %s and %d * typo * Missing ) * Apply suggestions from code review Co-authored-by: Lysandre Debut <lysandre@huggingface.co> Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
This commit is contained in:
@@ -62,7 +62,7 @@ def parse_flag_from_env(key, default=False):
|
||||
_value = strtobool(value)
|
||||
except ValueError:
|
||||
# More values are supported, but let's keep the message simple.
|
||||
raise ValueError("If set, {} must be yes or no.".format(key))
|
||||
raise ValueError(f"If set, {key} must be yes or no.")
|
||||
return _value
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ def parse_int_from_env(key, default=None):
|
||||
try:
|
||||
_value = int(value)
|
||||
except ValueError:
|
||||
raise ValueError("If set, {} must be a int.".format(key))
|
||||
raise ValueError(f"If set, {key} must be a int.")
|
||||
return _value
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user