kittycad.models.modeling_cmd
Classes
|
Add a hole to a closed path by offsetting it a uniform distance inward. |
|
Create a new non-manifold body by intersecting all the input bodies, cutting and splitting all the faces at the intersection boundaries. |
|
Create a new solid from intersecting several other solids. |
|
Create a new solid from subtracting several other solids. |
|
Create a new solid from combining other smaller solids. |
|
Camera drag ended |
|
Camera drag continued. |
|
Camera drag started. |
|
Get the center of mass of entities in the scene or the default scene. |
|
Closes a path, converting it to a 2D solid. |
|
Create a region bounded by the intersection of various paths. |
|
Get control points of the given curve. |
|
Find the start and end of a curve. |
|
Get type of the given curve. |
|
Get the plane for sketch mode. |
|
Updates the camera to center to the center of the current scene's bounds |
Updates the camera to center to the center of the current selection (or the origin if nothing is selected) |
|
|
Focus the default camera upon an object in the scene. |
|
Gets the default camera's camera settings |
|
Gets the default camera's view state |
|
Change what the default camera is looking at. |
Change what the default camera is looking at. |
|
Use orthographic projection. |
|
Use perspective projection. |
|
|
Sets the default camera's view state |
|
Adjust zoom of the default camera. |
|
Get the density of entities in the scene or the default scene. |
|
Sets whether or not changes to the scene or its objects will be done as a "dry run" In a dry run, successful commands won't actually change the model. |
|
Changes visibility of scene-wide edge lines on brep solids |
|
Sets whether or not changes to the scene or its objects will be done as a "dry run" In a dry run, successful commands won't actually change the model. |
|
Sketch on some entity (e.g. a plane, a face). |
|
Evaluates the position of a path in one shot (engine utility for kcl executor) |
|
Create a circular pattern using this entity. |
|
Create a pattern using this entity by specifying the transform for each desired repetition. |
|
Attempts to delete children entity from an entity. |
|
Fade entity in or out. |
|
What are all UUIDs of this entity's children? |
|
What is the UUID of this entity's n-th child? |
|
What is the distance between these two entities? |
|
What is this entity's child index within its parent |
|
How many children does the entity have? |
|
What is this entity's parent? |
|
What is this edge or face entity's primitive index within its parent body's edges or faces array respectively |
|
What are all UUIDs of all the paths sketched on top of this entity? |
|
Create a linear pattern using this entity. |
Create a pattern using this entity by specifying the transform for each desired repetition. |
|
|
Create a helix using the input cylinder and other specified parameters. |
|
Create a helix using the specified parameters. |
|
Create a helix using the specified parameters. |
|
Mirror the input entities over the specified axis. |
|
Mirror the input entities over the specified edge. |
|
Set opacity of the entity. |
|
Export the scene to a file. |
|
Export a sketch to a file. |
|
Export the scene to a file. |
|
Extend a path by adding a new segment which starts at the path's "pen". |
|
Command for extruding a solid 2d. |
|
Command for extruding a solid 2d to a reference geometry. |
|
Obtains the surface "center of mass" |
|
Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v |
|
Determines a position on a brep face evaluated by parameters u,v |
|
Determines whether a brep face is planar and returns its surface-local planar axes if so |
|
What type of entity is this? |
|
Get the number of objects in the scene |
|
Get the plane for sketch mode. |
|
Stop dragging the mouse. |
|
Continue dragging the mouse. |
|
Start dragging the mouse. |
|
Changes the current highlighted entity to these entities. |
|
Changes the current highlighted entity to whichever one is at the given window coordinate. |
|
Import files to the current model. |
|
Command for lofting sections to create a solid |
|
Add a gizmo showing the axes. |
|
Make a new path by offsetting an object by a given distance. |
|
Make a new plane |
|
Get the mass of entities in the scene or the default scene. |
|
Send a mouse click event Updates modified/selected entities. |
|
Send a mouse move event |
|
Move the path's "pen". |
|
Create a new annotation |
|
Bring an object to the front of the scene |
|
Set the material properties of an object |
|
Hide or show an object |
|
Looks along the normal of the specified face (if it is planar!), and fits the view to it. |
|
Obtain curve id by index |
Obtain curve ids for vertex ids |
|
|
Query the given path. |
|
Obtain the sketch target id (if the path was drawn in sketchmode) for a path |
|
Obtain vertex ids for a path |
|
Utility method. |
|
Set the color of a plane. |
|
Project an entity on to a plane. |
|
Project a list of points on to a plane. |
|
Reconfigure the stream. |
|
Remove scene objects. |
|
Command for revolving a solid 2d. |
|
Command for revolving a solid 2d about a brep edge |
|
Removes all of the Objects in the scene |
|
Get the ids of a given entity type. |
|
Adds one or more entities (by UUID) to the selection. |
|
Clear the selection |
|
Find all IDs of selected entities |
|
The user clicked on a point in the window, returns the region the user clicked on, if any. |
|
Removes one or more entities (by UUID) from the selection. |
|
Replaces current selection with these entities (by UUID). |
|
Modifies the selection by simulating a "mouse click" at the given x,y window coordinate Returns ID of whatever was selected. |
|
Send object to front or back. |
|
Set the background color of the scene. |
|
Set the properties of the tool lines for the scene. |
|
Set the default system properties used when a specific property isn't set. |
|
Set the grid lines to auto scale. |
|
Align the grid with a plane or a planar face. |
|
Set the scale of the grid lines in the video feed. |
|
Set the transform of an object. |
Render transparent surfaces more accurately, but this might make rendering slower. |
|
|
Set the units of the scene. |
|
What kind of entities can be selected? |
|
When you select some entity with the current tool, what should happen to the entity? |
|
Set the current tool. |
|
Disable sketch mode. |
|
Add a hole to a Solid2d object before extruding it. |
|
Cut the list of given edges with the given cut parameters. |
|
Fillets the given edge with the specified radius. |
|
Flips (reverses) a brep that is "inside-out". |
|
Flips (reverses) a face. |
|
Get a concise description of all of solids edges. |
|
Gets all faces which use the given edge. |
|
Gets all edges which are opposite the given edge, across all possible faces. |
|
Retrieves the body type. |
|
Gets the shared edge between these two faces if it exists |
|
What is the UUID of this body's n-th edge? |
Get a concise description of all of an extrusion's faces. |
|
|
What is the UUID of this body's n-th face? |
|
Gets the next adjacent edge for the given edge, along the given face. |
|
Gets the edge opposite the given edge, along the given face. |
|
Gets the previous adjacent edge for the given edge, along the given face. |
|
Command for joining a Surface (non-manifold) body back to a Solid. |
|
Command for shelling a solid3d face |
|
Start a new path. |
|
Get the surface area of entities in the scene or the default scene. |
|
Command for creating a blend between the edge of two given surfaces |
|
Extrude the object along a path. |
|
Take a snapshot of the current view. |
|
Command for twist extruding a solid 2d. |
|
Update an annotation |
|
Fit the view to the scene with an isometric view. |
|
Get the volume of entities in the scene or the default scene. |
|
Fit the view to the specified object(s). |
- class kittycad.models.modeling_cmd.OptionAddHoleFromOffset(**data)[source][source]
Add a hole to a closed path by offsetting it a uniform distance inward.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'object_id': FieldInfo(annotation=str, required=True), 'offset': FieldInfo(annotation=LengthUnit, required=True), 'type': FieldInfo(annotation=Literal['add_hole_from_offset'], required=False, default='add_hole_from_offset')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- offset: LengthUnit[source]
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionBooleanImprint(**data)[source][source]
Create a new non-manifold body by intersecting all the input bodies, cutting and splitting all the faces at the intersection boundaries.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'body_ids': FieldInfo(annotation=List[str], required=True), 'separate_bodies': FieldInfo(annotation=bool, required=False, default=False), 'tolerance': FieldInfo(annotation=LengthUnit, required=True), 'type': FieldInfo(annotation=Literal['boolean_imprint'], required=False, default='boolean_imprint')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- to_json()[source]
Convert model to JSON string with alias support.
- Return type:
- Returns:
JSON string representation of the model.
- tolerance: LengthUnit[source]
- class kittycad.models.modeling_cmd.OptionBooleanIntersection(**data)[source][source]
Create a new solid from intersecting several other solids. In other words, the part of the input solids where they all overlap will be the output solid.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'separate_bodies': FieldInfo(annotation=bool, required=False, default=False), 'solid_ids': FieldInfo(annotation=List[str], required=True), 'tolerance': FieldInfo(annotation=LengthUnit, required=True), 'type': FieldInfo(annotation=Literal['boolean_intersection'], required=False, default='boolean_intersection')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- to_json()[source]
Convert model to JSON string with alias support.
- Return type:
- Returns:
JSON string representation of the model.
- tolerance: LengthUnit[source]
- class kittycad.models.modeling_cmd.OptionBooleanSubtract(**data)[source][source]
Create a new solid from subtracting several other solids. The ‘target’ is what will be cut from. The ‘tool’ is what will be cut out from ‘target’.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'separate_bodies': FieldInfo(annotation=bool, required=False, default=False), 'target_ids': FieldInfo(annotation=List[str], required=True), 'tolerance': FieldInfo(annotation=LengthUnit, required=True), 'tool_ids': FieldInfo(annotation=List[str], required=True), 'type': FieldInfo(annotation=Literal['boolean_subtract'], required=False, default='boolean_subtract')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- to_json()[source]
Convert model to JSON string with alias support.
- Return type:
- Returns:
JSON string representation of the model.
- tolerance: LengthUnit[source]
- class kittycad.models.modeling_cmd.OptionBooleanUnion(**data)[source][source]
Create a new solid from combining other smaller solids. In other words, every part of the input solids will be included in the output solid.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'separate_bodies': FieldInfo(annotation=bool, required=False, default=False), 'solid_ids': FieldInfo(annotation=List[str], required=True), 'tolerance': FieldInfo(annotation=LengthUnit, required=True), 'type': FieldInfo(annotation=Literal['boolean_union'], required=False, default='boolean_union')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- to_json()[source]
Convert model to JSON string with alias support.
- Return type:
- Returns:
JSON string representation of the model.
- tolerance: LengthUnit[source]
- class kittycad.models.modeling_cmd.OptionCameraDragEnd(**data)[source][source]
Camera drag ended
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- interaction: CameraDragInteractionType[source]
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'interaction': FieldInfo(annotation=CameraDragInteractionType, required=True), 'type': FieldInfo(annotation=Literal['camera_drag_end'], required=False, default='camera_drag_end'), 'window': FieldInfo(annotation=Point2d, required=True)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCameraDragMove(**data)[source][source]
Camera drag continued.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- interaction: CameraDragInteractionType[source]
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'interaction': FieldInfo(annotation=CameraDragInteractionType, required=True), 'sequence': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'type': FieldInfo(annotation=Literal['camera_drag_move'], required=False, default='camera_drag_move'), 'window': FieldInfo(annotation=Point2d, required=True)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCameraDragStart(**data)[source][source]
Camera drag started.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- interaction: CameraDragInteractionType[source]
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'interaction': FieldInfo(annotation=CameraDragInteractionType, required=True), 'type': FieldInfo(annotation=Literal['camera_drag_start'], required=False, default='camera_drag_start'), 'window': FieldInfo(annotation=Point2d, required=True)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCenterOfMass(**data)[source][source]
Get the center of mass of entities in the scene or the default scene.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'entity_ids': FieldInfo(annotation=List[str], required=True), 'output_unit': FieldInfo(annotation=UnitLength, required=True), 'type': FieldInfo(annotation=Literal['center_of_mass'], required=False, default='center_of_mass')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- output_unit: UnitLength[source]
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionClosePath(**data)[source][source]
Closes a path, converting it to a 2D solid.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'path_id': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['close_path'], required=False, default='close_path')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCreateRegion(**data)[source][source]
Create a region bounded by the intersection of various paths. The region should have an ID taken from the ID of the ‘CreateRegion’ modeling command.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'curve_clockwise': FieldInfo(annotation=bool, required=False, default=False), 'intersection_index': FieldInfo(annotation=int, required=False, default=-1), 'intersection_segment': FieldInfo(annotation=str, required=True), 'object_id': FieldInfo(annotation=str, required=True), 'segment': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['create_region'], required=False, default='create_region')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCurveGetControlPoints(**data)[source][source]
Get control points of the given curve.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'curve_id': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['curve_get_control_points'], required=False, default='curve_get_control_points')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCurveGetEndPoints(**data)[source][source]
Find the start and end of a curve.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'curve_id': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['curve_get_end_points'], required=False, default='curve_get_end_points')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCurveGetType(**data)[source][source]
Get type of the given curve.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'curve_id': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['curve_get_type'], required=False, default='curve_get_type')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionCurveSetConstraint(**data)[source][source]
Get the plane for sketch mode.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- constraint_bound: PathComponentConstraintBound[source]
- constraint_type: PathComponentConstraintType[source]
- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'constraint_bound': FieldInfo(annotation=PathComponentConstraintBound, required=True), 'constraint_type': FieldInfo(annotation=PathComponentConstraintType, required=True), 'object_id': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['curve_set_constraint'], required=False, default='curve_set_constraint')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraCenterToScene(**data)[source][source]
Updates the camera to center to the center of the current scene’s bounds
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- camera_movement: CameraMovement[source]
- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'camera_movement': FieldInfo(annotation=CameraMovement, required=False, default='vantage'), 'type': FieldInfo(annotation=Literal['default_camera_center_to_scene'], required=False, default='default_camera_center_to_scene')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraCenterToSelection(**data)[source][source]
Updates the camera to center to the center of the current selection (or the origin if nothing is selected)
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- camera_movement: CameraMovement[source]
- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'camera_movement': FieldInfo(annotation=CameraMovement, required=False, default='vantage'), 'type': FieldInfo(annotation=Literal['default_camera_center_to_selection'], required=False, default='default_camera_center_to_selection')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraFocusOn(**data)[source][source]
Focus the default camera upon an object in the scene.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'type': FieldInfo(annotation=Literal['default_camera_focus_on'], required=False, default='default_camera_focus_on'), 'uuid': FieldInfo(annotation=str, required=True)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraGetSettings(**data)[source][source]
Gets the default camera’s camera settings
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'type': FieldInfo(annotation=Literal['default_camera_get_settings'], required=False, default='default_camera_get_settings')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraGetView(**data)[source][source]
Gets the default camera’s view state
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'type': FieldInfo(annotation=Literal['default_camera_get_view'], required=False, default='default_camera_get_view')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraLookAt(**data)[source][source]
Change what the default camera is looking at.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'center': FieldInfo(annotation=Point3d, required=True), 'sequence': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'type': FieldInfo(annotation=Literal['default_camera_look_at'], required=False, default='default_camera_look_at'), 'up': FieldInfo(annotation=Point3d, required=True), 'vantage': FieldInfo(annotation=Point3d, required=True)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraPerspectiveSettings(**data)[source][source]
Change what the default camera is looking at.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'center': FieldInfo(annotation=Point3d, required=True), 'fov_y': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'sequence': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'type': FieldInfo(annotation=Literal['default_camera_perspective_settings'], required=False, default='default_camera_perspective_settings'), 'up': FieldInfo(annotation=Point3d, required=True), 'vantage': FieldInfo(annotation=Point3d, required=True), 'z_far': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'z_near': FieldInfo(annotation=Union[float, NoneType], required=False, default=None)}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraSetOrthographic(**data)[source][source]
Use orthographic projection.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'type': FieldInfo(annotation=Literal['default_camera_set_orthographic'], required=False, default='default_camera_set_orthographic')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraSetPerspective(**data)[source][source]
Use perspective projection.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode (
Literal['json','python'] |str) – The mode in whichto_pythonshould run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to include in the output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – A set of fields to exclude from the output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to use the field’s alias in the dictionary key if defined.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A dictionary representation of the model.
- model_dump_json(*, indent=None, ensure_ascii=False, include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, exclude_computed_fields=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)[source]
- !!! abstract “Usage Documentation”
[
model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s
to_jsonmethod.- Parameters:
indent (
int|None) – Indentation to use in the JSON output. If None is passed, the output will be compact.ensure_ascii (
bool) – IfTrue, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is.include (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to include in the JSON output.exclude (
set[int] |set[str] |Mapping[int,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |Mapping[str,set[int] |set[str] |Mapping[int, IncEx |bool] |Mapping[str, IncEx |bool] |bool] |None) – Field(s) to exclude from the JSON output.context (
Any|None) – Additional context to pass to the serializer.by_alias (
bool|None) – Whether to serialize using field aliases.exclude_unset (
bool) – Whether to exclude fields that have not been explicitly set.exclude_defaults (
bool) – Whether to exclude fields that are set to their default value.exclude_none (
bool) – Whether to exclude fields that have a value ofNone.exclude_computed_fields (
bool) – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicatedround_tripparameter instead.round_trip (
bool) – If True, dumped values should be valid as input for non-idempotent types such as Json[T].warnings (
bool|Literal['none','warn','error']) – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].fallback (
Callable[[Any],Any] |None) – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.serialize_as_any (
bool) – Whether to serialize fields with duck-typing serialization behavior.
- Return type:
- Returns:
A JSON string representation of the model.
- property model_extra: dict[str, Any] | None[source]
Get extra fields set during validation.
- Returns:
A dictionary of extra fields, or
Noneifconfig.extrais not set to"allow".
- model_fields = {'parameters': FieldInfo(annotation=Union[PerspectiveCameraParameters, NoneType], required=False, default=None), 'type': FieldInfo(annotation=Literal['default_camera_set_perspective'], required=False, default='default_camera_set_perspective')}[source]
- property model_fields_set: set[str][source]
Returns the set of fields that have been explicitly set on this model instance.
- Returns:
- A set of strings representing the fields that have been set,
i.e. that were not filled from defaults.
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation', *, union_format='any_of')[source]
Generates a JSON schema for a model class.
- Parameters:
by_alias (
bool) – Whether to use attribute aliases or not.ref_template (
str) – The reference template.union_format (
Literal['any_of','primitive_type_array']) –The format to use when combining schemas from unions together. Can be one of:
'any_of': Use the [anyOf](https://json-schema.org/understanding-json-schema/reference/combining#anyOf)
keyword to combine schemas (the default). -
'primitive_type_array': Use the [type](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (string,Boolean Operations — and, or, not,null,integerornumber) or contains constraints/metadata, falls back toany_of.schema_generator (
type[GenerateJsonSchema]) – To override the logic used to generate the JSON schema, as a subclass ofGenerateJsonSchemawith your desired modificationsmode (
Literal['validation','serialization']) – The mode in which to generate the schema.
- Return type:
- Returns:
The JSON schema for the given model class.
- classmethod model_parametrized_name(params)[source]
Compute the class name for parametrizations of generic classes.
This method can be overridden to achieve a custom naming scheme for generic BaseModels.
- Parameters:
params (
tuple[type[Any],...]) – Tuple of types of the class. Given a generic classModelwith 2 type variables and a concrete modelModel[str, int], the value(str, int)would be passed toparams.- Return type:
- Returns:
String representing the new class where
paramsare passed toclsas type variables.- Raises:
TypeError – Raised when trying to generate concrete names for non-generic models.
- model_post_init(context, /)[source]
Override this method to perform additional initialization after
__init__andmodel_construct. This is useful if you want to do some validation that requires the entire model to be initialized.- Return type:
- classmethod model_rebuild(*, force=False, raise_errors=True, _parent_namespace_depth=2, _types_namespace=None)[source]
Try to rebuild the pydantic-core schema for the model.
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.
- Parameters:
force (
bool) – Whether to force the rebuilding of the model schema, defaults toFalse.raise_errors (
bool) – Whether to raise errors, defaults toTrue._parent_namespace_depth (
int) – The depth level of the parent namespace, defaults to 2._types_namespace (
Mapping[str,Any] |None) – The types namespace, defaults toNone.
- Return type:
- Returns:
Returns
Noneif the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returnsTrueif rebuilding was successful, otherwiseFalse.
- classmethod model_validate(obj, *, strict=None, extra=None, from_attributes=None, context=None, by_alias=None, by_name=None)[source]
Validate a pydantic model instance.
- Parameters:
obj (
Any) – The object to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.from_attributes (
bool|None) – Whether to extract data from object attributes.context (
Any|None) – Additional context to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError – If the object could not be validated.
- Return type:
Self- Returns:
The validated model instance.
- classmethod model_validate_json(json_data, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
- !!! abstract “Usage Documentation”
[JSON Parsing](../concepts/json.md#json-parsing)
Validate the given JSON data against the Pydantic model.
- Parameters:
json_data (
str|bytes|bytearray) – The JSON data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- Raises:
ValidationError – If
json_datais not a JSON string or the object could not be validated.
- classmethod model_validate_strings(obj, *, strict=None, extra=None, context=None, by_alias=None, by_name=None)[source]
Validate the given object with string data against the Pydantic model.
- Parameters:
obj (
Any) – The object containing string data to validate.extra (
Literal['allow','ignore','forbid'] |None) – Whether to ignore, allow, or forbid extra data during model validation. See the [extraconfiguration value][pydantic.ConfigDict.extra] for details.context (
Any|None) – Extra variables to pass to the validator.by_alias (
bool|None) – Whether to use the field’s alias when validating against the provided input data.by_name (
bool|None) – Whether to use the field’s name when validating against the provided input data.
- Return type:
Self- Returns:
The validated Pydantic model.
- parameters: PerspectiveCameraParameters | None[source]
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)[source]
- Return type:
Self
- classmethod schema_json(*, by_alias=True, ref_template='#/$defs/{model}', **dumps_kwargs)[source]
- Return type:
- class kittycad.models.modeling_cmd.OptionDefaultCameraSetView(**data)[source][source]
Sets the default camera’s view state
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- copy(*, include=None, exclude=None, update=None, deep=False)[source]
Returns a copy of the model.
- !!! warning “Deprecated”
This method is now deprecated; use
model_copyinstead.
If you need
includeorexclude, use:`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `- Parameters:
include (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to include in the copied model.exclude (
Set[int] |Set[str] |Mapping[int,Any] |Mapping[str,Any] |None) – Optional set or mapping specifying which fields to exclude in the copied model.update (
Dict[str,Any] |None) – Optional dictionary of field-value pairs to override field values in the copied model.deep (
bool) – If True, the values of fields that are Pydantic models will be deep-copied.
- Return type:
Self- Returns:
A copy of the model with included, excluded and updated fields as specified.
- dict(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)[source]
- classmethod from_dict(data)[source]
Create model instance from dictionary.
- Parameters:
- Return type:
- Returns:
Model instance.
Example
user_data = {“id”: “123”, “name”: “John”} user = User.from_dict(user_data)
- classmethod from_json(json_str)[source]
Create model instance from JSON string.
- Parameters:
json_str (
str) – JSON string containing model data.- Return type:
- Returns:
Model instance.
Example
user_json = ‘{“id”: “123”, “name”: “John”}’ user = User.from_json(user_json)
- json(*, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=PydanticUndefined, models_as_dict=PydanticUndefined, **dumps_kwargs)[source]
- Return type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'protected_namespaces': (), 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}[source]
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- classmethod model_construct(_fields_set=None, **values)[source]
Creates a new instance of the
Modelclass with validated data.Creates a new model setting
__dict__and__pydantic_fields_set__from trusted or pre-validated data. Default values are respected, but no other validation is performed.- !!! note
model_construct()generally respects themodel_config.extrasetting on the provided model. That is, ifmodel_config.extra == 'allow', then all extra passed values are added to the model instance’s__dict__and__pydantic_extra__fields. Ifmodel_config.extra == 'ignore'(the default), then all extra passed values are ignored. Because no validation is performed with a call tomodel_construct(), havingmodel_config.extra == 'forbid'does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set (
set[str] |None) – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from thevaluesargument will be used.values (
Any) – Trusted or pre-validated data dictionary.
- Return type:
Self- Returns:
A new instance of the
Modelclass with validated data.
- model_copy(*, update=None, deep=False)[source]
- !!! abstract “Usage Documentation”
[
model_copy](../concepts/models.md#model-copy)
Returns a copy of the model.
- !!! note
The underlying instance’s [
__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).
- model_dump(*, mode='python', include=None,