Index
pyvider.cty
¶
TODO: Add module docstring.
Attributes¶
BytesCapsule
module-attribute
¶
A capsule type for wrapping raw bytes.
Classes¶
CtyCapsule
¶
Represents a capsule type in the Cty type system. Capsule types are opaque types that can be used to wrap arbitrary Python objects.
Source code in pyvider/cty/types/capsule.py
CtyCapsuleWithOps
¶
CtyCapsuleWithOps(
capsule_name: str,
py_type: type,
*,
equal_fn: Callable[[Any, Any], bool] | None = None,
hash_fn: Callable[[Any], int] | None = None,
convert_fn: (
Callable[[Any, CtyType[Any]], CtyValue[Any] | None]
| None
) = None
)
Bases: CtyCapsule
A CtyCapsule that supports custom operations like equality, hashing, and conversion.
Initializes a CtyCapsule with custom operational functions.
Source code in pyvider/cty/types/capsule.py
Functions¶
CtyConversionError
¶
CtyConversionError(
message: str,
*,
source_value: object | None = None,
target_type: object | None = None,
**kwargs: Any
)
Bases: CtyError
Base for CTY value or type conversion errors.
Initializes the CtyConversionError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The base error message. |
required |
source_value
|
object | None
|
The value that was being converted. |
None
|
target_type
|
object | None
|
The intended target type of the conversion. |
None
|
**kwargs
|
Any
|
Additional foundation error context. |
{}
|
Source code in pyvider/cty/exceptions/conversion.py
Functions¶
CtyDynamic
¶
Represents a dynamic type that can hold any CtyValue.
Functions¶
validate
¶
Validates a raw Python value for a dynamic type. The result is always a CtyValue of type CtyDynamic, which wraps the inferred concrete value.
Source code in pyvider/cty/types/structural/dynamic.py
CtyMark
¶
Represents a mark that can be applied to a cty.Value. The 'details' attribute is automatically converted to a hashable frozenset.
CtyType
¶
Bases: CtyTypeProtocol[T], Generic[T], ABC
Generic abstract base class for all Cty types.
CtyTypeParseError
¶
Bases: CtyConversionError
Raised when a CTY type string cannot be parsed.
Source code in pyvider/cty/exceptions/conversion.py
CtyValidationError
¶
CtyValidationError(
message: str,
value: object = None,
type_name: str | None = None,
path: CtyPath | None = None,
**kwargs: Any
)
Bases: ValidationError
Base exception for all validation errors.
Inherits from foundation's ValidationError for enhanced diagnostics and automatic retry/circuit breaker support where applicable.
Source code in pyvider/cty/exceptions/validation.py
Functions¶
convert
¶
Converts a CtyValue to a new CtyValue of the target CtyType.
Source code in pyvider/cty/conversion/explicit.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
parse_tf_type_to_ctytype
¶
Parses a Terraform type constraint, represented as a raw Python object (typically from JSON), into a CtyType instance.
Source code in pyvider/cty/parser.py
unify
¶
Finds a single common CtyType that all of the given types can convert to. This is a wrapper that enables caching by converting input to a frozenset.