Format
ToString
Bases: Protocol
Represents types that can be converted to strings.
Source code in src/wraps/parse/format.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
to_string() -> str
Converts self to its string representation.
Returns:
| Type | Description |
|---|---|
str
|
The string representation of |
Source code in src/wraps/parse/format.py
14 15 16 17 18 19 20 21 | |
to_short_string() -> str
Converts self to its (short) string representation.
The default implementation simply calls to_string.
Returns:
| Type | Description |
|---|---|
str
|
The (short) string representation of |
Source code in src/wraps/parse/format.py
23 24 25 26 27 28 29 30 31 | |
__str__() -> str
Calls to_string and returns the result.
Returns:
| Type | Description |
|---|---|
str
|
The string representation of |
Source code in src/wraps/parse/format.py
33 34 35 36 37 38 39 | |
to_string(value: ToString) -> str
Calls to_string method on the given value
and returns the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
ToString
|
The value to convert to string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The string representation of |
Source code in src/wraps/parse/format.py
42 43 44 45 46 47 48 49 50 51 52 | |
to_short_string(value: ToString) -> str
Calls to_short_string method
on the given value and returns the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
ToString
|
The value to convert to string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The (short) string representation of |
Source code in src/wraps/parse/format.py
55 56 57 58 59 60 61 62 63 64 65 | |