polyapi-python 0.3.20.dev4__tar.gz → 0.3.21.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/PKG-INFO +1 -1
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/ai_function.py +1 -2
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/server.py +1 -2
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/utils.py +8 -3
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/PKG-INFO +1 -1
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/pyproject.toml +1 -1
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_server.py +6 -4
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/LICENSE +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/README.md +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/__init__.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/__main__.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/api.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/auth.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/cli.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/cli_constants.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/client.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/config.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/constants.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/deployables.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/execute.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/function_cli.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/generate.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/http_client.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/parser.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/poly_schemas.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/poly_tables.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/prepare.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/py.typed +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/rendered_spec.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/schema.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/sync.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/variables.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi/webhook.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/setup.cfg +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_api.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_async_proof.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_auth.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_cli.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_dependency_pins.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_deployables.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_generate.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_generated_poly_boundary.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_parser.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_poly_custom.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_poly_schemas.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_rendered_spec.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_schema.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_tabi.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_utils.py +0 -0
- {polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_variables.py +0 -0
|
@@ -75,8 +75,7 @@ def render_ai_function(
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _normalize_return_type_for_annotation(function_name: str, return_type_name: str) -> str:
|
|
78
|
-
|
|
79
|
-
return "ReturnType"
|
|
78
|
+
# "ReturnType" lives in a separate module, so it must be qualified (e.g. _SFX.ReturnType).
|
|
80
79
|
return add_type_import_path(function_name, return_type_name)
|
|
81
80
|
|
|
82
81
|
|
|
@@ -75,8 +75,7 @@ def render_server_function(
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _normalize_return_type_for_annotation(function_name: str, return_type_name: str) -> str:
|
|
78
|
-
|
|
79
|
-
return "ReturnType"
|
|
78
|
+
# "ReturnType" lives in a separate module, so it must be qualified (e.g. _SFX.ReturnType).
|
|
80
79
|
return add_type_import_path(function_name, return_type_name)
|
|
81
80
|
|
|
82
81
|
|
|
@@ -102,7 +102,8 @@ def normalize_cross_language_type(type_name: str) -> str:
|
|
|
102
102
|
normalized = [normalize_cross_language_type(part) for part in parts]
|
|
103
103
|
return " | ".join(normalized) if normalized else "Any"
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
# Only TS's ReturnType<...>/typeof syntax falls back to Any, not our own "ReturnType" name.
|
|
106
|
+
if value.startswith("ReturnType<") or "typeof" in value:
|
|
106
107
|
return "Any"
|
|
107
108
|
|
|
108
109
|
return primitive_map.get(value, value)
|
|
@@ -220,8 +221,12 @@ def get_type_and_def( # noqa: C901
|
|
|
220
221
|
return "List", ""
|
|
221
222
|
elif title and title == "ReturnType" and schema.get("type"):
|
|
222
223
|
assert isinstance(title, str)
|
|
223
|
-
|
|
224
|
-
root_type, generated_code = wrapped_generate_schema_types(schema,
|
|
224
|
+
# Use `title` as the class name, not schema["type"] (e.g. "object" collides with dict).
|
|
225
|
+
root_type, generated_code = wrapped_generate_schema_types(schema, title, "Dict") # type: ignore
|
|
226
|
+
if f"class {root_type}(" not in generated_code:
|
|
227
|
+
# A property-less object schema (e.g. bare {"type": "object"}) generates no
|
|
228
|
+
# class at all, so root_type would reference a name that doesn't exist.
|
|
229
|
+
return "Dict", ""
|
|
225
230
|
return (map_primitive_types(root_type), "") if is_primitive(root_type) else (root_type, generated_code) # type: ignore
|
|
226
231
|
elif title:
|
|
227
232
|
assert isinstance(title, str)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "polyapi-python"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.21.dev0"
|
|
8
8
|
description = "The Python SDK for the integration platform PolyAPI"
|
|
9
9
|
authors = [{ name = "PolyAPI", email = "support@polyapi.io" }]
|
|
10
10
|
dependencies = [
|
|
@@ -151,8 +151,9 @@ class T(unittest.TestCase):
|
|
|
151
151
|
# self.assertIn(expected_return_type, func_str)
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
def
|
|
154
|
+
def test_render_function_return_type_name_collision_uses_qualified_reference(self):
|
|
155
155
|
return_type = RETURN_TYPE_NAMED_RETURN_TYPE["function"]["returnType"]
|
|
156
|
+
name = RETURN_TYPE_NAMED_RETURN_TYPE["name"]
|
|
156
157
|
func_str, func_type_defs = render_server_function(
|
|
157
158
|
RETURN_TYPE_NAMED_RETURN_TYPE["type"],
|
|
158
159
|
RETURN_TYPE_NAMED_RETURN_TYPE["name"],
|
|
@@ -161,9 +162,10 @@ class T(unittest.TestCase):
|
|
|
161
162
|
RETURN_TYPE_NAMED_RETURN_TYPE["function"]["arguments"],
|
|
162
163
|
return_type,
|
|
163
164
|
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
self.
|
|
165
|
+
# The real "ReturnType" class must be generated and referenced via its
|
|
166
|
+
# qualified module alias, not collapsed to a generic "dict".
|
|
167
|
+
self.assertIn(f"-> {to_type_module_alias(name)}.ReturnType", func_str)
|
|
168
|
+
self.assertIn("class ReturnType(", func_type_defs)
|
|
167
169
|
|
|
168
170
|
def test_render_function_string_union_returns_text(self):
|
|
169
171
|
function_name = "getMaybeName"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/polyapi_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.20.dev4 → polyapi_python-0.3.21.dev0}/tests/test_generated_poly_boundary.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|