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
13 changes: 7 additions & 6 deletions polyapi/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -318,17 +318,17 @@ 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
# e.g. kube_hunter is the import name, but the pip name is kube-hunter
# 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": "",
Expand Down Expand Up @@ -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}'")
Expand All @@ -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 = '"""'
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.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 = [
Expand Down