EncodedStr
A str type that is encoded and decoded using the specified encoder.
Attributes
| Attribute | Type | Description |
|---|---|---|
| encoder | type[[EncoderProtocol](encoderprotocol.md?sid=pydantic_types_encoderprotocol)] | The class implementing EncoderProtocol used to transform data between its encoded and decoded string representations. |
Constructor
Signature
def EncodedStr(
encoder: type[[EncoderProtocol](encoderprotocol.md?sid=pydantic_types_encoderprotocol)]
)
Parameters
| Name | Type | Description |
|---|---|---|
| encoder | type[[EncoderProtocol](encoderprotocol.md?sid=pydantic_types_encoderprotocol)] | The encoder class used for encoding and decoding string data. |
Methods
decode_str()
@classmethod
def decode_str(
data: str,
_: core_schema.ValidationInfo
) - > str
Decode the data using the specified encoder.
Parameters
| Name | Type | Description |
|---|---|---|
| data | str | The data to decode. |
| _ | core_schema.ValidationInfo | Pydantic validation context, currently unused by this implementation. |
Returns
| Type | Description |
|---|---|
str | The decoded data. |
encode_str()
@classmethod
def encode_str(
value: str
) - > str
Encode the data using the specified encoder.
Parameters
| Name | Type | Description |
|---|---|---|
| value | str | The data to encode. |
Returns
| Type | Description |
|---|---|
str | The encoded data. |