Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts/pr_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def verify_allowed_user(self) -> bool:
# check if the user is a member of opendatahub-tests-contributors
membership = team.get_team_membership(member=self.user_login)
LOGGER.info(f"User {self.user_login} is a member of the test contributor team. {membership}")
return True # noqa: TRY300
return True
except UnknownObjectException:
LOGGER.error(f"User {self.user_login} is not allowed for this action. Exiting.")
return False
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
exclude: .*/__snapshots__/.*|.*-input\.json$|^semgrep\.yaml$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
rev: v0.15.6
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -50,7 +50,7 @@ repos:
# - id: renovate-config-validator

- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
rev: v8.30.1
hooks:
- id: gitleaks

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def registry_pull_secret(pytestconfig: Config) -> list[str]:
try:
for secret in registry_pull_secret:
base64.b64decode(s=secret, validate=True)
return registry_pull_secret # noqa: TRY300
return registry_pull_secret
except binascii.Error:
raise ValueError("Registry pull secret is not a valid base64 encoded string")

Expand Down Expand Up @@ -253,7 +253,7 @@ def modelcar_yaml_config(pytestconfig: pytest.Config) -> dict[str, Any] | None:
modelcar_yaml = yaml.safe_load(file)
if not isinstance(modelcar_yaml, dict):
raise ValueError("modelcar.yaml should contain a dictionary.") # noqa: TRY004
return modelcar_yaml # noqa: TRY300
return modelcar_yaml
except yaml.YAMLError as e:
raise ValueError(f"Error parsing modelcar.yaml: {e}") from e

Expand Down
2 changes: 1 addition & 1 deletion tests/llama_stack/safety/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def guardrails_orchestrator_ssl_cert(guardrails_orchestrator_route: Route):
with open(filepath, "w") as f:
f.write("\n".join(cert_lines))

return filepath # noqa: TRY300
return filepath

except Exception as e: # noqa: BLE001
raise RuntimeError(f"Could not get certificate from {hostname}: {e}")
Expand Down
2 changes: 1 addition & 1 deletion tests/llama_stack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def wait_for_llama_stack_client_ready(client: LlamaStackClient) -> bool:
f"vector_stores:{len(vector_stores.data)} "
f"files:{len(files.data)})"
)
return True # noqa: TRY300
return True

except (APIConnectionError, InternalServerError) as error:
LOGGER.debug(f"Llama Stack server not ready yet: {error}")
Expand Down
2 changes: 1 addition & 1 deletion tests/model_registry/model_catalog/huggingface/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_huggingface_nested_attributes(obj, attr_path) -> Any:
if not hasattr(current_obj, attr):
return None
current_obj = getattr(current_obj, attr)
return current_obj # noqa: TRY300
return current_obj
except AttributeError as e:
LOGGER.error(f"AttributeError getting '{attr_path}': {e}")
return None
Expand Down
2 changes: 1 addition & 1 deletion tests/model_registry/model_catalog/metadata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def get_metadata_from_catalog_pod(model_catalog_pod: Pod, model_name: str) -> di
metadata_json = model_catalog_pod.execute(command=["cat", metadata_path], container=CATALOG_CONTAINER)
metadata = json.loads(metadata_json)
LOGGER.info(f"Successfully loaded metadata.json for model '{model_name}'")
return metadata # noqa: TRY300
return metadata
except Exception as e:
LOGGER.error(f"Failed to read metadata.json for model '{model_name}': {e}")
raise
Expand Down
2 changes: 1 addition & 1 deletion tests/model_registry/model_registry/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def sa_token(service_account: ServiceAccount) -> str:
raise ValueError("Retrieved token is empty after successful command execution.")

LOGGER.info(f"Successfully retrieved token for SA '{sa_name}'")
return token # noqa: TRY300
return token

except Exception as e: # Catch all exceptions from the try block
error_type = type(e).__name__
Expand Down
2 changes: 1 addition & 1 deletion tests/model_serving/model_server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def _is_kueue_operator_installed(admin_client: DynamicClient) -> bool:
if csv.name.startswith("kueue") and csv.status == csv.Status.SUCCEEDED:
LOGGER.info(f"Found Kueue operator CSV: {csv.name}")
return True
return False # noqa: TRY300
return False
except ResourceNotFoundError:
return False

Expand Down
2 changes: 1 addition & 1 deletion utilities/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ def check_internal_image_registry_available(admin_client: DynamicClient) -> bool
is_available = management_state == "managed"

LOGGER.info(f"Image registry management state: {management_state}, available: {is_available}")
return is_available # noqa: TRY300
return is_available
except (ResourceNotFoundError, Exception) as e: # noqa: BLE001
LOGGER.warning(f"Failed to check image registry config: {e}")
return False
Expand Down
2 changes: 1 addition & 1 deletion utilities/plugins/openai_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_request_http(host: str, endpoint: str) -> Any:
keys_to_remove = ["created", "id"]
if data:
data = OpenAIClient._remove_keys(data, keys_to_remove)
return data # noqa: TRY300
return data
except requests.exceptions.RequestException, json.JSONDecodeError:
LOGGER.exception("Request error")

Expand Down
2 changes: 1 addition & 1 deletion utilities/plugins/tgis_grpc_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def make_grpc_request(self, query: dict[str, Any]) -> Any:
response = stub.Generate(request=request)
LOGGER.info(response)
res = response.responses[0]
return { # noqa: TRY300
return {
"input_tokens": res.input_token_count,
"stop_reason": res.stop_reason,
"output_text": res.text,
Expand Down
Loading