Commit 99f17a1
committed
👌
The `PseudoPotentialData` is currently missing a `get_description` method, which means
this returns the default empty string derived from the `Node` class. The default
`__repr__` method also does not show one of the most important attributes of the
`PseudoPotentialData` class: the element it represents.
Here we add the `__repr__` and `get_description` methods to the `PseudoPotentialData`
class. Although these could (and perhaps should) serve a different purpose, we don't
want users to be confused when they see a difference between:
* the pseudos dictionary returned by `builder.pseudos`, which uses `__repr__`.
* The `__repr_pretty__` method of the `ProcessBuilder`, which uses `get_description`
for `Node` objects.
Hence, we make them return the same output by having the `get_description` method
call `repr`. For the contents, we choose to add:
* The class name, so they can see the type of pseudopotential.
* The element of the pseudopotential.
* The PK of the pseudpotential node.
We skip the UUID to reduce the noise. In most local usage the PK is much more common,
and the user can still easily get the UUID using `node.uuid`.PseudoPotentialData: Improve string representation1 parent 0b542c2 commit 99f17a1
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
0 commit comments