Generate signature for a pydantic BaseModel or dataclass. Args: init: The class init. fields: The model fields. validate_by_name: The `validate_by_name` value of the config. extra: The `extra` value of the config. is_dataclass: Whether the model is a data
(
init: Callable[..., None],
fields: dict[str, FieldInfo],
validate_by_name: bool,
extra: ExtraValues | None,
is_dataclass: bool = False,
)
| 163 | |
| 164 | |
| 165 | def generate_pydantic_signature( |
| 166 | init: Callable[..., None], |
| 167 | fields: dict[str, FieldInfo], |
| 168 | validate_by_name: bool, |
| 169 | extra: ExtraValues | None, |
| 170 | is_dataclass: bool = False, |
| 171 | ) -> Signature: |
| 172 | """Generate signature for a pydantic BaseModel or dataclass. |
| 173 | |
| 174 | Args: |
| 175 | init: The class init. |
| 176 | fields: The model fields. |
| 177 | validate_by_name: The `validate_by_name` value of the config. |
| 178 | extra: The `extra` value of the config. |
| 179 | is_dataclass: Whether the model is a dataclass. |
| 180 | |
| 181 | Returns: |
| 182 | The dataclass/BaseModel subclass signature. |
| 183 | """ |
| 184 | merged_params = _generate_signature_parameters(init, fields, validate_by_name, extra) |
| 185 | |
| 186 | if is_dataclass: |
| 187 | merged_params = {k: _process_param_defaults(v) for k, v in merged_params.items()} |
| 188 | |
| 189 | return Signature(parameters=list(merged_params.values()), return_annotation=None) |
nothing calls this directly
no test coverage detected