Skip to content
Open
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ markers = [
"local: tests of functionality which do not involve a server or writing to an offline cache file",
"object_retrieval: tests relating to retrieval of objects from the server",
"object_removal: tests relating to removal of objects from the server",
"filters: tests of filter objects",
]

[tool.interrogate]
Expand Down
13 changes: 10 additions & 3 deletions simvue/api/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
from simvue.api.url import URL

try:
from typing import Self
from typing import Self, override
except ImportError:
from typing_extensions import Self
from typing_extensions import Self, override # noqa: UP035

# Need to use this inside of Generator typing to fix bug present in Python 3.10 - see issue #745
T = typing.TypeVar("T", bound="SimvueObject")
Expand Down Expand Up @@ -806,18 +806,25 @@ def staged(self) -> dict[str, typing.Any] | None:
"""
return self._staging or None

@override
def __str__(self) -> str:
"""String representation of Simvue object."""
return f"{self.__class__.__name__}({self.id=})"

@override
def __repr__(self) -> str:
_out_str = f"{self.__class__.__module__}.{self.__class__.__qualname__}("
_property_values: list[str] = []
_property_warn_list: list[str] = []

for property in self._properties:
try:
_value = getattr(self, property)
except KeyError:
except (KeyError, Exception):
# Display a warning only once if a property could not be retrieved
if property not in _property_warn_list:
self._logger.warning(f"Failed to retrieve property '{property}'")
_property_warn_list.append(property)
continue

if isinstance(_value, types.GeneratorType):
Expand Down
331 changes: 0 additions & 331 deletions simvue/api/objects/filter.py

This file was deleted.

6 changes: 6 additions & 0 deletions simvue/api/objects/filter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Simvue server object filters."""

from .folder import FoldersFilter
from .run import RunsFilter, Status

__all__ = ["FoldersFilter", "RunsFilter", "Status"]
Loading
Loading