diff --git a/generate/generate.py b/generate/generate.py index 84ce2b7dd..6f5749785 100755 --- a/generate/generate.py +++ b/generate/generate.py @@ -136,8 +136,10 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): ": " + parameter_type + ",\n") - f.write("*, client: Client) -> Dict[str, Any]:\n") - f.write("\turl = \"{}" + name + "\".format(client.base_url,\n") + f.write("\t*,\n") + f.write("\tclient: Client,\n") + f.write(") -> Dict[str, Any]:\n") + f.write("\turl = \"{}" + name + "\".format(client.base_url") # Iterate over the parameters. if 'parameters' in endpoint: parameters = endpoint['parameters'] @@ -153,12 +155,11 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): print(" parameter: ", parameter) raise Exception("Unknown parameter type") f.write( - "\t" + + ", " + parameter_name + "=" + - camel_to_snake(parameter_name) + - ",\n") - f.write("\t)\n") + camel_to_snake(parameter_name)) + f.write(")\n") f.write("\n") f.write("\theaders: Dict[str, Any] = client.get_headers()\n") f.write("\tcookies: Dict[str, Any] = client.get_cookies()\n") @@ -244,7 +245,9 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): ": " + parameter_type + ",\n") - f.write("*, client: Client) -> Response[Union[Any, " + + f.write("\t*,\n") + f.write("\tclient: Client,\n") + f.write(") -> Response[Union[Any, " + ", ".join(endoint_refs) + "]]:\n") f.write("\tkwargs = _get_kwargs(\n") @@ -303,7 +306,9 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): ": " + parameter_type + ",\n") - f.write("*, client: Client) -> Optional[Union[Any, " + + f.write("\t*,\n") + f.write("\tclient: Client,\n") + f.write(") -> Optional[Union[Any, " + ", ".join(endoint_refs) + "]]:\n") if 'description' in endpoint: @@ -325,7 +330,7 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): print(" parameter: ", parameter) raise Exception("Unknown parameter type") f.write( - "\t" + + "\t\t" + camel_to_snake(parameter_name) + "=" + camel_to_snake(parameter_name) + @@ -358,7 +363,9 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): ": " + parameter_type + ",\n") - f.write("*, client: Client) -> Response[Union[Any, " + + f.write("\t*,\n") + f.write("\tclient: Client,\n") + f.write(") -> Response[Union[Any, " + ", ".join(endoint_refs) + "]]:\n") f.write("\tkwargs = _get_kwargs(\n") @@ -415,13 +422,16 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): ": " + parameter_type + ",\n") - f.write("*, client: Client) -> Optional[Union[Any, " + + f.write("\t*,\n") + f.write("\tclient: Client,\n") + f.write(") -> Optional[Union[Any, " + ", ".join(endoint_refs) + "]]:\n") if 'description' in endpoint: f.write("\t\"\"\" " + endpoint['description'] + " \"\"\"\n") f.write("\n") - f.write("\treturn (await asyncio_detailed(\n") + f.write("\treturn (\n") + f.write("\t\tawait asyncio_detailed(\n") # Iterate over the parameters. if 'parameters' in endpoint: parameters = endpoint['parameters'] @@ -437,13 +447,14 @@ def generatePath(path: str, name: str, method: str, endpoint: dict): print(" parameter: ", parameter) raise Exception("Unknown parameter type") f.write( - "\t\t" + + "\t\t\t" + camel_to_snake(parameter_name) + "=" + camel_to_snake(parameter_name) + ",\n") - f.write("\t\tclient=client,\n") - f.write("\t)).parsed\n") + f.write("\t\t\tclient=client,\n") + f.write("\t\t)\n") + f.write("\t).parsed\n") # Close the file. f.close() @@ -864,7 +875,8 @@ def getEndpointRefs(endpoint: dict) -> [str]: json = content[content_type]['schema'] if '$ref' in json: ref = json['$ref'].replace('#/components/schemas/', '') - refs.append(ref) + if ref not in refs: + refs.append(ref) return refs diff --git a/kittycad/api/file/file_conversion_status.py b/kittycad/api/file/file_conversion_status.py index cbac6f981..858e7acab 100644 --- a/kittycad/api/file/file_conversion_status.py +++ b/kittycad/api/file/file_conversion_status.py @@ -8,10 +8,10 @@ from ...types import Response def _get_kwargs( id: str, -*, client: Client) -> Dict[str, Any]: - url = "{}/file/conversion/{id}".format(client.base_url, - id=id, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/file/conversion/{id}".format(client.base_url, id=id) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -57,7 +57,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv def sync_detailed( id: str, -*, client: Client) -> Response[Union[Any, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( id=id, client=client, @@ -73,18 +75,22 @@ def sync_detailed( def sync( id: str, -*, client: Client) -> Optional[Union[Any, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Get the status and output of an async file conversion. """ return sync_detailed( - id=id, + id=id, client=client, ).parsed async def asyncio_detailed( id: str, -*, client: Client) -> Response[Union[Any, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( id=id, client=client, @@ -98,10 +104,14 @@ async def asyncio_detailed( async def asyncio( id: str, -*, client: Client) -> Optional[Union[Any, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Get the status and output of an async file conversion. """ - return (await asyncio_detailed( - id=id, - client=client, - )).parsed + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/kittycad/api/file/post_file_conversion.py b/kittycad/api/file/post_file_conversion.py index fec157d74..ef5789ae0 100644 --- a/kittycad/api/file/post_file_conversion.py +++ b/kittycad/api/file/post_file_conversion.py @@ -4,7 +4,6 @@ import httpx from ...client import Client from ...models.file_conversion import FileConversion -from ...models.file_conversion import FileConversion from ...models.valid_source_file_format import ValidSourceFileFormat from ...models.valid_output_file_format import ValidOutputFileFormat from ...types import Response @@ -12,11 +11,10 @@ from ...types import Response def _get_kwargs( source_format: ValidSourceFileFormat, output_format: ValidOutputFileFormat, -*, client: Client) -> Dict[str, Any]: - url = "{}/file/conversion/{sourceFormat}/{outputFormat}".format(client.base_url, - sourceFormat=source_format, - outputFormat=output_format, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/file/conversion/{sourceFormat}/{outputFormat}".format(client.base_url, sourceFormat=source_format, outputFormat=output_format) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -29,7 +27,7 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileConversion]]: +def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion]]: if response.status_code == 200: response_200 = FileConversion.from_dict(response.json()) return response_200 @@ -54,7 +52,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv return None -def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileConversion]]: +def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion]]: return Response( status_code=response.status_code, content=response.content, @@ -66,7 +64,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv def sync_detailed( source_format: ValidSourceFileFormat, output_format: ValidOutputFileFormat, -*, client: Client) -> Response[Union[Any, FileConversion, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( source_format=source_format, output_format=output_format, @@ -84,12 +84,14 @@ def sync_detailed( def sync( source_format: ValidSourceFileFormat, output_format: ValidOutputFileFormat, -*, client: Client) -> Optional[Union[Any, FileConversion, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously. """ return sync_detailed( - source_format=source_format, - output_format=output_format, + source_format=source_format, + output_format=output_format, client=client, ).parsed @@ -97,7 +99,9 @@ def sync( async def asyncio_detailed( source_format: ValidSourceFileFormat, output_format: ValidOutputFileFormat, -*, client: Client) -> Response[Union[Any, FileConversion, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( source_format=source_format, output_format=output_format, @@ -113,11 +117,15 @@ async def asyncio_detailed( async def asyncio( source_format: ValidSourceFileFormat, output_format: ValidOutputFileFormat, -*, client: Client) -> Optional[Union[Any, FileConversion, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously. """ - return (await asyncio_detailed( - source_format=source_format, - output_format=output_format, - client=client, - )).parsed + return ( + await asyncio_detailed( + source_format=source_format, + output_format=output_format, + client=client, + ) + ).parsed diff --git a/kittycad/api/internal/gpu_devices.py b/kittycad/api/internal/gpu_devices.py index f8bb3ca8d..fe21b68d8 100644 --- a/kittycad/api/internal/gpu_devices.py +++ b/kittycad/api/internal/gpu_devices.py @@ -6,9 +6,10 @@ from ...client import Client from ...types import Response def _get_kwargs( -*, client: Client) -> Dict[str, Any]: - url = "{}/_internal/gpu/devices".format(client.base_url, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/_internal/gpu/devices".format(client.base_url) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -43,7 +44,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ]]: def sync_detailed( -*, client: Client) -> Response[Union[Any, ]]: + *, + client: Client, +) -> Response[Union[Any, ]]: kwargs = _get_kwargs( client=client, ) @@ -57,7 +60,9 @@ def sync_detailed( def sync( -*, client: Client) -> Optional[Union[Any, ]]: + *, + client: Client, +) -> Optional[Union[Any, ]]: """ Get information about GPU devices on this server. This is primarily used for debugging. This endpoint can only be used by specific KittyCAD employees. """ return sync_detailed( @@ -66,7 +71,9 @@ def sync( async def asyncio_detailed( -*, client: Client) -> Response[Union[Any, ]]: + *, + client: Client, +) -> Response[Union[Any, ]]: kwargs = _get_kwargs( client=client, ) @@ -78,9 +85,13 @@ async def asyncio_detailed( async def asyncio( -*, client: Client) -> Optional[Union[Any, ]]: + *, + client: Client, +) -> Optional[Union[Any, ]]: """ Get information about GPU devices on this server. This is primarily used for debugging. This endpoint can only be used by specific KittyCAD employees. """ - return (await asyncio_detailed( - client=client, - )).parsed + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/kittycad/api/internal/stop_async_conversions.py b/kittycad/api/internal/stop_async_conversions.py index 053639d47..39ecfcc68 100644 --- a/kittycad/api/internal/stop_async_conversions.py +++ b/kittycad/api/internal/stop_async_conversions.py @@ -7,9 +7,10 @@ from ...models.file_conversion import FileConversion from ...types import Response def _get_kwargs( -*, client: Client) -> Dict[str, Any]: - url = "{}/_internal/async/conversions/stop".format(client.base_url, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/_internal/async/conversions/stop".format(client.base_url) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -48,7 +49,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv def sync_detailed( -*, client: Client) -> Response[Union[Any, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( client=client, ) @@ -62,7 +65,9 @@ def sync_detailed( def sync( -*, client: Client) -> Optional[Union[Any, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """ return sync_detailed( @@ -71,7 +76,9 @@ def sync( async def asyncio_detailed( -*, client: Client) -> Response[Union[Any, FileConversion]]: + *, + client: Client, +) -> Response[Union[Any, FileConversion]]: kwargs = _get_kwargs( client=client, ) @@ -83,9 +90,13 @@ async def asyncio_detailed( async def asyncio( -*, client: Client) -> Optional[Union[Any, FileConversion]]: + *, + client: Client, +) -> Optional[Union[Any, FileConversion]]: """ Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """ - return (await asyncio_detailed( - client=client, - )).parsed + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/kittycad/api/meta/auth_session.py b/kittycad/api/meta/auth_session.py index 48e3aa2b7..688d49aae 100644 --- a/kittycad/api/meta/auth_session.py +++ b/kittycad/api/meta/auth_session.py @@ -7,9 +7,10 @@ from ...models.auth_session import AuthSession from ...types import Response def _get_kwargs( -*, client: Client) -> Dict[str, Any]: - url = "{}/_meta/debug/session".format(client.base_url, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/_meta/debug/session".format(client.base_url) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -45,7 +46,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, AuthSess def sync_detailed( -*, client: Client) -> Response[Union[Any, AuthSession]]: + *, + client: Client, +) -> Response[Union[Any, AuthSession]]: kwargs = _get_kwargs( client=client, ) @@ -59,7 +62,9 @@ def sync_detailed( def sync( -*, client: Client) -> Optional[Union[Any, AuthSession]]: + *, + client: Client, +) -> Optional[Union[Any, AuthSession]]: """ Get information about your API request session. This is primarily used for debugging. """ return sync_detailed( @@ -68,7 +73,9 @@ def sync( async def asyncio_detailed( -*, client: Client) -> Response[Union[Any, AuthSession]]: + *, + client: Client, +) -> Response[Union[Any, AuthSession]]: kwargs = _get_kwargs( client=client, ) @@ -80,9 +87,13 @@ async def asyncio_detailed( async def asyncio( -*, client: Client) -> Optional[Union[Any, AuthSession]]: + *, + client: Client, +) -> Optional[Union[Any, AuthSession]]: """ Get information about your API request session. This is primarily used for debugging. """ - return (await asyncio_detailed( - client=client, - )).parsed + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/kittycad/api/meta/instance_metadata.py b/kittycad/api/meta/instance_metadata.py index bba74ec86..fc87d815c 100644 --- a/kittycad/api/meta/instance_metadata.py +++ b/kittycad/api/meta/instance_metadata.py @@ -7,9 +7,10 @@ from ...models.instance import Instance from ...types import Response def _get_kwargs( -*, client: Client) -> Dict[str, Any]: - url = "{}/_meta/debug/instance".format(client.base_url, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/_meta/debug/instance".format(client.base_url) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -45,7 +46,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Instance def sync_detailed( -*, client: Client) -> Response[Union[Any, Instance]]: + *, + client: Client, +) -> Response[Union[Any, Instance]]: kwargs = _get_kwargs( client=client, ) @@ -59,7 +62,9 @@ def sync_detailed( def sync( -*, client: Client) -> Optional[Union[Any, Instance]]: + *, + client: Client, +) -> Optional[Union[Any, Instance]]: """ Get information about this specific API server instance. This is primarily used for debugging. """ return sync_detailed( @@ -68,7 +73,9 @@ def sync( async def asyncio_detailed( -*, client: Client) -> Response[Union[Any, Instance]]: + *, + client: Client, +) -> Response[Union[Any, Instance]]: kwargs = _get_kwargs( client=client, ) @@ -80,9 +87,13 @@ async def asyncio_detailed( async def asyncio( -*, client: Client) -> Optional[Union[Any, Instance]]: + *, + client: Client, +) -> Optional[Union[Any, Instance]]: """ Get information about this specific API server instance. This is primarily used for debugging. """ - return (await asyncio_detailed( - client=client, - )).parsed + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/kittycad/api/meta/ping.py b/kittycad/api/meta/ping.py index e24df2d73..bbfedaa21 100644 --- a/kittycad/api/meta/ping.py +++ b/kittycad/api/meta/ping.py @@ -7,9 +7,10 @@ from ...models.pong_message import PongMessage from ...types import Response def _get_kwargs( -*, client: Client) -> Dict[str, Any]: - url = "{}/ping".format(client.base_url, - ) + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/ping".format(client.base_url) headers: Dict[str, Any] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() @@ -39,7 +40,9 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, PongMess def sync_detailed( -*, client: Client) -> Response[Union[Any, PongMessage]]: + *, + client: Client, +) -> Response[Union[Any, PongMessage]]: kwargs = _get_kwargs( client=client, ) @@ -53,7 +56,9 @@ def sync_detailed( def sync( -*, client: Client) -> Optional[Union[Any, PongMessage]]: + *, + client: Client, +) -> Optional[Union[Any, PongMessage]]: """ Simple ping to the server. """ return sync_detailed( @@ -62,7 +67,9 @@ def sync( async def asyncio_detailed( -*, client: Client) -> Response[Union[Any, PongMessage]]: + *, + client: Client, +) -> Response[Union[Any, PongMessage]]: kwargs = _get_kwargs( client=client, ) @@ -74,9 +81,13 @@ async def asyncio_detailed( async def asyncio( -*, client: Client) -> Optional[Union[Any, PongMessage]]: + *, + client: Client, +) -> Optional[Union[Any, PongMessage]]: """ Simple ping to the server. """ - return (await asyncio_detailed( - client=client, - )).parsed + return ( + await asyncio_detailed( + client=client, + ) + ).parsed