Get a value from a config string such as an environment variable or CLI arguments. Traits can override this method to define their own parsing of config strings. .. seealso:: item_from_string .. versionadded:: 5.0
(self, s: str)
| 592 | self.metadata["help"] = help |
| 593 | |
| 594 | def from_string(self, s: str) -> G | None: |
| 595 | """Get a value from a config string |
| 596 | |
| 597 | such as an environment variable or CLI arguments. |
| 598 | |
| 599 | Traits can override this method to define their own |
| 600 | parsing of config strings. |
| 601 | |
| 602 | .. seealso:: item_from_string |
| 603 | |
| 604 | .. versionadded:: 5.0 |
| 605 | """ |
| 606 | if self.allow_none and s == "None": |
| 607 | return None |
| 608 | return s # type:ignore[return-value] |
| 609 | |
| 610 | def default(self, obj: t.Any = None) -> G | None: |
| 611 | """The default generator for this trait |
nothing calls this directly
no outgoing calls
no test coverage detected