upgrade pydantic (#266)

* upgrade pydantic

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update other deps

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update other deps

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* ruff

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* bump more deps

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* bump

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-09-10 12:52:57 -07:00
committed by GitHub
parent b430b49382
commit bf0710f0e6
221 changed files with 2158 additions and 3109 deletions

View File

@ -1,4 +1,4 @@
""" Contains all the data models used in inputs/outputs """
"""Contains all the data models used in inputs/outputs"""
from .account_provider import AccountProvider
from .add_org_member import AddOrgMember

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.user_org_role import UserOrgRole

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.unit_angle import UnitAngle

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.annotation_line_end import AnnotationLineEnd

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.annotation_text_alignment_x import AnnotationTextAlignmentX

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ApiCallQueryGroup(BaseModel):
"""A response for a query on the API call table that is grouped by something."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.error_code import ErrorCode

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class AppClientInfo(BaseModel):
"""Information about a third party app client."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class AuthCallback(BaseModel):
"""The authentication callback from the OAuth 2.0 client. This is typically posted to the redirect URL as query params after authenticating."""

View File

@ -6,8 +6,7 @@ class Axis(str, Enum):
See [cglearn.eu] for background reading.
[cglearn.eu]: https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1
""" # noqa: E501
[cglearn.eu]: https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1""" # noqa: E501
"""# 'Y' axis. """ # noqa: E501
Y = "y"

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.axis import Axis

View File

@ -1,45 +1,32 @@
import base64
import binascii
from typing import Any
from typing import Any, Type
from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema, core_schema
from pydantic_core import core_schema
class Base64Data:
def __init__(self, data: bytes):
"""
Initializes the object.
If the provided data is already in base64 encoded format, it will store it.
If the data is a regular byte string, it will encode and then store it.
"""
if self.is_base64(data):
self._data = str(data, "utf-8")
else:
encoded = base64.b64encode(data)
self._data = str(encoded, "utf-8")
@staticmethod
def is_base64(data: bytes) -> bool:
"""Checks if given data is base64 encoded."""
try:
str_data = str(data, "utf-8")
_ = base64.urlsafe_b64decode(str_data.strip("=") + "===")
return True
except binascii.Error:
return False
def get_encoded(self) -> str:
"""Returns the stored base64 encoded data."""
return self._data
def get_decoded(self) -> bytes:
"""Returns the decoded byte string."""
return base64.urlsafe_b64decode(self._data.strip("=") + "===")
class Base64Data(bytes):
@classmethod
def __get_pydantic_core_schema__(
cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
return core_schema.no_info_after_validator_function(cls, handler(bytes))
cls, source: Type[Any], handler: GetCoreSchemaHandler
) -> core_schema.CoreSchema:
return core_schema.no_info_after_validator_function(
cls.validate,
core_schema.union_schema(
[
core_schema.str_schema(),
core_schema.bytes_schema(),
]
),
serialization=core_schema.plain_serializer_function_ser_schema(
cls.serialize
),
)
@classmethod
def validate(cls, v):
return base64.urlsafe_b64decode(v.strip("=") + "===")
@classmethod
def serialize(cls, v: "Base64Data") -> bytes:
return v

View File

@ -3,7 +3,6 @@ from typing import Union
from pydantic import BaseModel, ConfigDict, RootModel
class response(BaseModel):
"""Response to the modeling command."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class CacheMetadata(BaseModel):
"""Metadata about our cache.

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ClientMetrics(BaseModel):
"""ClientMetrics contains information regarding the state of the peer."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ClosePath(BaseModel):
"""The response from the `ClosePath` command."""

View File

@ -3,7 +3,6 @@ from typing import List, Optional
from pydantic import BaseModel, ConfigDict
class Cluster(BaseModel):
"""Cluster information."""

View File

@ -6,8 +6,7 @@ class CodeLanguage(str, Enum):
<details><summary>JSON schema</summary>
```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ``` </details>
""" # noqa: E501
```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ``` </details>""" # noqa: E501
"""# The `go` programming language. """ # noqa: E501
GO = "go"

View File

@ -10,8 +10,7 @@ class CodeOutput(BaseModel):
<details><summary>JSON schema</summary>
```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
"""
```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>"""
output_files: Optional[List[OutputFile]] = None

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Color(BaseModel):
"""An RGBA color"""

View File

@ -3,7 +3,6 @@ from typing import Dict, Optional
from pydantic import BaseModel, ConfigDict
class Coupon(BaseModel):
"""The resource representing a Coupon."""

View File

@ -7,8 +7,7 @@ from pydantic_core import CoreSchema, core_schema
class Currency(str):
"""Currency is the list of supported currencies. Always lowercase.
This comes from the Stripe API docs: For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>.
"""
This comes from the Stripe API docs: For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>."""
def __str__(self) -> str:
return self

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.curve_type import CurveType

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class DefaultCameraFocusOn(BaseModel):
"""The response from the `DefaultCameraFocusOn` command."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.camera_settings import CameraSettings

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.unit_density import UnitDensity

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from .base64data import Base64Data

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.o_auth2_grant_type import OAuth2GrantType

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class DeviceAuthRequestForm(BaseModel):
"""The request parameters for the OAuth 2.0 Device Authorization Grant flow."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class DeviceAuthVerifyParams(BaseModel):
"""The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.coupon import Coupon

View File

@ -4,7 +4,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class DiscountCode(BaseModel):
"""A discount code for a store."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class EmailAuthenticationForm(BaseModel):
"""The body of the form for email authentication."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class EntityCircularPattern(BaseModel):
"""The response from the `EntityCircularPattern` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class EntityGetAllChildUuids(BaseModel):
"""The response from the `EntityGetAllChildUuids` command."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class EntityGetChildUuid(BaseModel):
"""The response from the `EntityGetChildUuid` command."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.length_unit import LengthUnit

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class EntityGetNumChildren(BaseModel):
"""The response from the `EntityGetNumChildren` command."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class EntityGetParentId(BaseModel):
"""The response from the `EntityGetParentId` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class EntityGetSketchPaths(BaseModel):
"""The response from the `EntityGetSketchPaths` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class EntityLinearPattern(BaseModel):
"""The response from the `EntityLinearPattern` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class EntityLinearPatternTransform(BaseModel):
"""The response from the `EntityLinearPatternTransform` command."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class Error(BaseModel):
"""Error information from a response."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from .base64data import Base64Data

View File

@ -10,8 +10,7 @@ from ..models.uuid import Uuid
class ExtendedUser(BaseModel):
"""Extended user information.
This is mostly used for internal purposes. It returns a mapping of the user's information, including that of our third party services we use for users: MailChimp | Stripe
"""
This is mostly used for internal purposes. It returns a mapping of the user's information, including that of our third party services we use for users: MailChimp | Stripe"""
block: Optional[BlockReason] = None

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class FileSystemMetadata(BaseModel):
"""Metadata about our file system.

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Gateway(BaseModel):
"""Gateway information."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.entity_type import EntityType

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class GetNumObjects(BaseModel):
"""The response from the `GetNumObjects` command."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.point3d import Point3d

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class HighlightSetEntity(BaseModel):
"""The response from the `HighlightSetEntity` command."""

View File

@ -3,7 +3,6 @@ from typing import List, Optional
from pydantic import BaseModel, ConfigDict
class IceServer(BaseModel):
"""Representation of an ICE server used for STUN/TURN Used to initiate WebRTC connections based on <https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer>"""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ImportFile(BaseModel):
"""File to import into the current model. If you are sending binary data for a file, be sure to send the WebSocketRequest as binary/bson, not text/json."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ImportFiles(BaseModel):
"""Data from importing the files"""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class ImportedGeometry(BaseModel):
"""Data from importing the files"""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.jetstream_config import JetstreamConfig

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class JetstreamApiStats(BaseModel):
"""Jetstream API statistics."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class JetstreamConfig(BaseModel):
"""Jetstream configuration."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.jetstream_api_stats import JetstreamApiStats

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class KclCodeCompletionParams(BaseModel):
"""Extra params for the completions."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class KclCodeCompletionResponse(BaseModel):
"""A response with KCL code completions."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class LeafNode(BaseModel):
"""Leaf node information."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Loft(BaseModel):
"""The response from the `Loft` command."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.unit_mass import UnitMass

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class MetaClusterInfo(BaseModel):
"""Jetstream statistics."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.cache_metadata import CacheMetadata

View File

@ -6,8 +6,7 @@ class Method(str, Enum):
This type also contains constants for a number of common HTTP methods such as GET, POST, etc.
Currently includes 8 variants representing the 8 methods defined in [RFC 7230](https://tools.ietf.org/html/rfc7231#section-4.1), plus PATCH, and an Extension variant for all extensions.
""" # noqa: E501
Currently includes 8 variants representing the 8 methods defined in [RFC 7230](https://tools.ietf.org/html/rfc7231#section-4.1), plus PATCH, and an Extension variant for all extensions.""" # noqa: E501
"""# The `OPTIONS` method as defined in [RFC 7231](https://tools.ietf.org/html/rfc7231#section-4.2.1). """ # noqa: E501
OPTIONS = "OPTIONS"

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.modeling_cmd import ModelingCmd

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class ModelingSessionData(BaseModel):
"""Successful Websocket response."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class MouseClick(BaseModel):
"""The response from the `MouseClick` command."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class OAuth2ClientInfo(BaseModel):
"""Information about an OAuth 2.0 client."""

View File

@ -4,7 +4,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class Onboarding(BaseModel):
"""Onboarding details"""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class OrgDetails(BaseModel):
"""The user-modifiable parts of an organization."""

View File

@ -3,14 +3,12 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class OutputFile(BaseModel):
"""Output file contents.
<details><summary>JSON schema</summary>
```json { \"description\": \"Output file contents.\", \"type\": \"object\", \"properties\": { \"contents\": { \"description\": \"The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.\", \"type\": \"string\" }, \"name\": { \"description\": \"The name of the file.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
"""
```json { \"description\": \"Output file contents.\", \"type\": \"object\", \"properties\": { \"contents\": { \"description\": \"The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.\", \"type\": \"string\" }, \"name\": { \"description\": \"The name of the file.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>"""
contents: Optional[str] = None

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class PathGetCurveUuid(BaseModel):
"""The response from the `PathGetCurveUuid` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class PathGetCurveUuidsForVertices(BaseModel):
"""The response from the `PathGetCurveUuidsForVertices` command."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class PathGetSketchTargetUuid(BaseModel):
"""The response from the `PathGetSketchTargetUuid` command."""

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class PathGetVertexUuids(BaseModel):
"""The response from the `PathGetVertexUuids` command."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class PaymentIntent(BaseModel):
"""A payment intent response."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class PaymentMethodCardChecks(BaseModel):
"""Card checks."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class PerspectiveCameraParameters(BaseModel):
"""Defines a perspective view."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.length_unit import LengthUnit

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Point3d(BaseModel):
"""A point in 3D space"""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Point4d(BaseModel):
"""A point in homogeneous (4D) space"""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class Pong(BaseModel):
"""The response from the `/ping` endpoint."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class PrivacySettings(BaseModel):
"""Privacy settings for an org or user."""

View File

@ -1,8 +1,6 @@
from pydantic import BaseModel, ConfigDict
class RawFile(BaseModel):
"""A raw file with unencoded contents to be passed over binary websockets. When raw files come back for exports it is sent as binary/bson, not text/json."""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.angle import Angle

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class RtcIceCandidateInit(BaseModel):
"""ICECandidateInit is used to serialize ice candidates"""

View File

@ -1,4 +1,3 @@
from pydantic import BaseModel, ConfigDict
from ..models.rtc_sdp_type import RtcSdpType

View File

@ -3,7 +3,6 @@ from typing import List
from pydantic import BaseModel, ConfigDict
class SelectGet(BaseModel):
"""The response from the `SelectGet` command."""

View File

@ -3,7 +3,6 @@ from typing import Optional
from pydantic import BaseModel, ConfigDict
class SelectWithPoint(BaseModel):
"""The response from the `SelectWithPoint` command."""

Some files were not shown because too many files have changed in this diff Show More