Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5265a4 commit 4fb3bdeCopy full SHA for 4fb3bde
1 file changed
lit_nlp/api/model.py
@@ -89,6 +89,18 @@ def description(self) -> str:
89
"""
90
return inspect.getdoc(self) or ''
91
92
+ def __str__(self) -> str:
93
+ classname = self.__class__.__module__ + '.' + self.__class__.__qualname__
94
+ indented_description = ' ' + self.description().replace('\n', '\n ')
95
+ return f'{classname}(...):\n{indented_description}'
96
+
97
+ def _repr_pretty_(self, p, cycle):
98
+ """Pretty-printing for IPython environments, both notebooks and repl."""
99
+ if not cycle:
100
+ p.text(str(self))
101
+ else:
102
+ p.text('...')
103
104
@classmethod
105
def init_spec(cls) -> Optional[Spec]:
106
"""Attempts to infer a Spec describing a Model's constructor parameters.
0 commit comments