mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[Polish] Simplify __repr__ method in Request class (#5153)
Remove detailed string representation for Request class.
This commit is contained in:
@@ -310,19 +310,7 @@ class Request:
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Safe string representation that ignores private and None fields."""
|
||||
try:
|
||||
if not envs.FD_DEBUG:
|
||||
return f"Request(request_id={self.request_id})"
|
||||
else:
|
||||
attrs_snapshot = dict(vars(self))
|
||||
non_none_fields = [
|
||||
f"{attr}={value!r}"
|
||||
for attr, value in attrs_snapshot.items()
|
||||
if value is not None and not attr.startswith("_")
|
||||
]
|
||||
return f"Request({', '.join(non_none_fields)})"
|
||||
except Exception as e:
|
||||
return f"<{self.__class__.__name__} repr failed: {e}>"
|
||||
return ""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
|
||||
Reference in New Issue
Block a user