Skip to content

Commit a719bc0

Browse files
authored
fix vari under no types (#56)
1 parent 0026216 commit a719bc0

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

polyapi/generate.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import requests
33
import os
44
import shutil
5-
from typing import List, Optional, Tuple, cast
5+
from typing import Any, List, Optional, Tuple, cast
66

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

4646
if contexts:
4747
params["contexts"] = contexts
@@ -155,7 +155,7 @@ def parse_function_specs(
155155

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

160160
functions.append(spec)
161161

@@ -321,11 +321,9 @@ def generate(contexts: Optional[List[str]] = None, names: Optional[List[str]] =
321321
)
322322
exit()
323323

324-
# Only process variables if no_types is False
325-
if not no_types:
326-
variables = get_variables()
327-
if variables:
328-
generate_variables(variables)
324+
variables = get_variables()
325+
if variables:
326+
generate_variables(variables)
329327

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

356354
arguments: List[PropertySpecification] = []
357-
return_type = {}
355+
return_type: Any = {}
358356
if spec.get("function"):
357+
assert spec["function"]
359358
# Handle cases where arguments might be missing or None
360359
if spec["function"].get("arguments"):
361360
arguments = [

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
33

44
[project]
55
name = "polyapi-python"
6-
version = "0.3.8.dev3"
6+
version = "0.3.8.dev4"
77
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
88
authors = [{ name = "Dan Fellin", email = "[email protected]" }]
99
dependencies = [

0 commit comments

Comments
 (0)