diff --git a/polyapi/parser.py b/polyapi/parser.py index c89d274..24dd7bf 100644 --- a/polyapi/parser.py +++ b/polyapi/parser.py @@ -5,7 +5,7 @@ import re from typing import Dict, List, Mapping, Optional, Tuple, Any from typing import _TypedDictMeta as BaseTypedDict # type: ignore -from typing_extensions import _TypedDictMeta # type: ignore +from typing_extensions import _TypedDictMeta, cast # type: ignore from stdlib_list import stdlib_list from pydantic import TypeAdapter from importlib.metadata import packages_distributions @@ -318,7 +318,7 @@ def _parse_value(value): return None -def parse_function_code(code: str, name: Optional[str] = "", context: Optional[str] = ""): +def parse_function_code(code: str, name: Optional[str] = "", context: Optional[str] = ""): # noqa: C901 schemas = _get_schemas(code) # the pip name and the import name might be different @@ -326,9 +326,9 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s # see https://stackoverflow.com/a/75144378 pip_name_lookup = packages_distributions() - deployable: DeployableRecord = { - "context": context, - "name": name, + deployable: DeployableRecord = { # type: ignore + "context": context, # type: ignore + "name": name, # type: ignore "description": "", "config": {}, "gitRevision": "", @@ -382,7 +382,7 @@ def visit_AnnAssign(self, node): if node.annotation.id == "PolyServerFunction": deployable["type"] = "server-function" elif node.annotation.id == "PolyClientFunction": - deployable["type"] = "server-function" + deployable["type"] = "client-function" else: print_red("ERROR") print(f"Unsupported polyConfig type '${node.annotation.id}'") @@ -405,6 +405,7 @@ def _extract_docstring_from_function(self, node: ast.FunctionDef): if type(docstring) is None or (not docstring and '"""' not in self._lines[start_lineno] and "'''" not in self._lines[start_lineno]): return None + docstring = cast(str, docstring) # Support both types of triple quotation marks pattern = '"""' diff --git a/pyproject.toml b/pyproject.toml index 8f0ac72..f0156d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.3.dev5" +version = "0.3.3.dev6" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [