StringRepresentable¶
- class zixy.container.base.StringRepresentable[source]¶
Bases:
ABCAbstract base class for classes that can be represented as, and constructed from, strings.
- abstractmethod classmethod from_str(source: str, *args: Any, **kwargs: Any) Self[source]¶
Create an instance of
clsfrom a string.- Parameters:
source – String to parse.
*args – Positional arguments to forward to a subsequent constructor.
**kwargs – Keyword arguments to forward to a subsequent constructor.
- Returns:
An instance of
clsparsed fromsource.
- classmethod parse(source: str) Self[source]¶
Parse a string into an instance of
cls.- Deprecated:
use
from_str()instead.
- Parameters:
source – String to parse.
- Returns:
An instance of
clsparsed fromsource.