mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add `Config.__repr__()
`
This commit is contained in:
parent
90ebd881fa
commit
c617138445
@ -285,6 +285,16 @@ class Config:
|
||||
|
||||
check_confval_types(None, self)
|
||||
|
||||
def __repr__(self):
|
||||
values = []
|
||||
for opt_name in self._options:
|
||||
try:
|
||||
opt_value = getattr(self, opt_name)
|
||||
except Exception:
|
||||
opt_value = '<error!>'
|
||||
values.append(f"{opt_name}={opt_value!r}")
|
||||
return self.__class__.__qualname__ + '(' + ', '.join(values) + ')'
|
||||
|
||||
def __getattr__(self, name: str) -> Any:
|
||||
if name.startswith('_'):
|
||||
raise AttributeError(name)
|
||||
|
Loading…
Reference in New Issue
Block a user