Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions polyapi/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import requests
import os
import shutil
from typing import List, Optional, Tuple, cast
from typing import Any, List, Optional, Tuple, cast

from .auth import render_auth_function
from .client import render_client_function
Expand Down Expand Up @@ -41,7 +41,7 @@ def get_specs(contexts: Optional[List[str]] = None, names: Optional[List[str]] =
assert api_key
headers = get_auth_headers(api_key)
url = f"{api_url}/specs"
params = {"noTypes": str(no_types).lower()}
params: Any = {"noTypes": str(no_types).lower()}

if contexts:
params["contexts"] = contexts
Expand Down Expand Up @@ -155,7 +155,7 @@ def parse_function_specs(

# Functions with serverSideAsync True will always return a Dict with execution ID
if spec.get('serverSideAsync') and spec.get("function"):
spec['function']['returnType'] = {'kind': 'plain', 'value': 'object'}
spec['function']['returnType'] = {'kind': 'plain', 'value': 'object'} # type: ignore

functions.append(spec)

Expand Down Expand Up @@ -321,11 +321,9 @@ def generate(contexts: Optional[List[str]] = None, names: Optional[List[str]] =
)
exit()

# Only process variables if no_types is False
if not no_types:
variables = get_variables()
if variables:
generate_variables(variables)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only real fix in this edit, the rest are mypy fixes!

variables = get_variables()
if variables:
generate_variables(variables)

# indicator to vscode extension that this is a polyapi-python project
file_path = os.path.join(os.getcwd(), ".polyapi-python")
Expand Down Expand Up @@ -354,8 +352,9 @@ def render_spec(spec: SpecificationDto) -> Tuple[str, str]:
function_id = spec["id"]

arguments: List[PropertySpecification] = []
return_type = {}
return_type: Any = {}
if spec.get("function"):
assert spec["function"]
# Handle cases where arguments might be missing or None
if spec["function"].get("arguments"):
arguments = [
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]

[project]
name = "polyapi-python"
version = "0.3.8.dev3"
version = "0.3.8.dev4"
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
dependencies = [
Expand Down