Skip to content

Commit

Permalink
Fix f-strings missing f prefix
Browse files Browse the repository at this point in the history
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
  • Loading branch information
harupy committed Feb 22, 2024
1 parent 191365d commit 16982e4
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/sktime/flavor.py
Expand Up @@ -218,7 +218,7 @@ def save_model(
message=(
f"Unrecognized serialization format: {serialization_format}. "
"Please specify one of the following supported formats: "
"{SUPPORTED_SERIALIZATION_FORMATS}."
f"{SUPPORTED_SERIALIZATION_FORMATS}."
),
error_code=INVALID_PARAMETER_VALUE,
)
Expand Down
2 changes: 1 addition & 1 deletion mlflow/gateway/providers/anthropic.py
Expand Up @@ -67,7 +67,7 @@ def completions_to_model(cls, payload, config):
if n != 1:
raise HTTPException(
status_code=422,
detail="'n' must be '1' for the Anthropic provider. Received value: '{n}'.",
detail=f"'n' must be '1' for the Anthropic provider. Received value: '{n}'.",
)

payload = rename_payload_keys(payload, key_mapping)
Expand Down
2 changes: 1 addition & 1 deletion mlflow/gateway/providers/bedrock.py
Expand Up @@ -50,7 +50,7 @@ def completions_to_model(cls, payload, config):
if n != 1:
raise HTTPException(
status_code=422,
detail="'n' must be '1' for AWS Titan models. Received value: '{n}'.",
detail=f"'n' must be '1' for AWS Titan models. Received value: '{n}'.",
)

# The range of Titan's temperature is 0-1, but ours is 0-2, so we halve it
Expand Down
3 changes: 1 addition & 2 deletions mlflow/recipes/cards/pandas_renderer.py
Expand Up @@ -291,15 +291,14 @@ def construct_facets_html(
protostr = base64.b64encode(proto.SerializeToString()).decode("utf-8")
polyfills_code = get_facets_polyfills()

html_template = """
return f"""
<div style="background-color: white">
<script>{polyfills_code}</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.3.3/webcomponents-lite.js"></script>
<link rel="import" href="https://raw.githubusercontent.com/PAIR-code/facets/1.0.0/facets-dist/facets-jupyter.html" >
<facets-overview id="facets" proto-input="{protostr}" compare-mode="{compare}"></facets-overview>
</div>
""" # noqa: E501
return html_template.format(protostr=protostr, compare=compare, polyfills_code=polyfills_code)


def get_html(inputs: Union[pd.DataFrame, Iterable[Tuple[str, pd.DataFrame]]]) -> str:
Expand Down
2 changes: 1 addition & 1 deletion mlflow/tracking/client.py
Expand Up @@ -3555,7 +3555,7 @@ def print_model_version_info(mv):
)
latest_versions = self.get_latest_versions(name, stages=[stage])
if not latest_versions:
raise MlflowException("Could not find any model version for {stage} stage")
raise MlflowException(f"Could not find any model version for {stage} stage")
version = latest_versions[0].version
self._get_registry_client().delete_model_version_tag(name, version, key)

Expand Down
4 changes: 2 additions & 2 deletions mlflow/transformers/signature.py
Expand Up @@ -105,14 +105,14 @@ def infer_or_get_default_signature(
if isinstance(e, MlflowTimeoutError):
msg = (
"Attempted to generate a signature for the saved pipeline but prediction timed "
"out after {timeout} seconds. Falling back to the default signature for the "
f"out after {timeout} seconds. Falling back to the default signature for the "
"pipeline. You can specify a signature manually or increase the timeout "
f"by setting the environment variable {MLFLOW_INPUT_EXAMPLE_INFERENCE_TIMEOUT}"
)
else:
msg = (
"Attempted to generate a signature for the saved pipeline but encountered an "
"error. Fall back to the default signature for the pipeline type. Error: {e}"
f"error. Fall back to the default signature for the pipeline type. Error: {e}"
)
_logger.warning(msg)

Expand Down
4 changes: 2 additions & 2 deletions mlflow/utils/model_utils.py
Expand Up @@ -220,12 +220,12 @@ def _validate_onnx_session_options(onnx_session_options):
elif key == "execution_mode" and value.upper() not in ["PARALLEL", "SEQUENTIAL"]:
raise ValueError(
f"Value for key {key} in onnx_session_options should be "
"'parallel' or 'sequential', not {value}"
f"'parallel' or 'sequential', not {value}"
)
elif key == "graph_optimization_level" and value not in [0, 1, 2, 99]:
raise ValueError(
f"Value for key {key} in onnx_session_options should be 0, 1, 2, or 99, "
"not {value}"
f"not {value}"
)
elif key in ["intra_op_num_threads", "intra_op_num_threads"] and value < 0:
raise ValueError(
Expand Down
4 changes: 2 additions & 2 deletions mlflow/utils/search_utils.py
Expand Up @@ -519,7 +519,7 @@ def is_string_attribute(cls, key_type, key_name, comparator):
if key_type == cls._ATTRIBUTE_IDENTIFIER and key_name not in cls.NUMERIC_ATTRIBUTES:
if comparator not in cls.VALID_STRING_ATTRIBUTE_COMPARATORS:
raise MlflowException(
"Invalid comparator '{comparator}' not one of "
f"Invalid comparator '{comparator}' not one of "
f"'{cls.VALID_STRING_ATTRIBUTE_COMPARATORS}'"
)
return True
Expand Down Expand Up @@ -932,7 +932,7 @@ def is_attribute(cls, key_type, comparator):
if key_type == cls._ATTRIBUTE_IDENTIFIER:
if comparator not in cls.VALID_STRING_ATTRIBUTE_COMPARATORS:
raise MlflowException(
"Invalid comparator '{comparator}' not one of "
f"Invalid comparator '{comparator}' not one of "
f"'{cls.VALID_STRING_ATTRIBUTE_COMPARATORS}'"
)
return True
Expand Down
2 changes: 1 addition & 1 deletion tests/store/tracking/test_file_store.py
Expand Up @@ -2382,7 +2382,7 @@ def test_log_input_multiple_times_does_not_overwrite_tags_or_dataset(store):
overwrite_dataset = Dataset(
name="name",
digest="digest",
source_type="st{i}",
source_type=f"st{i}",
source=f"source{i}",
schema=f"schema{i}",
profile=f"profile{i}",
Expand Down

0 comments on commit 16982e4

Please sign in to comment.