polyapi-python 0.3.3.dev5__py3-none-any.whl → 0.3.3.dev7__py3-none-any.whl

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/parser.py CHANGED
@@ -5,7 +5,7 @@ import sys
5
5
  import re
6
6
  from typing import Dict, List, Mapping, Optional, Tuple, Any
7
7
  from typing import _TypedDictMeta as BaseTypedDict # type: ignore
8
- from typing_extensions import _TypedDictMeta # type: ignore
8
+ from typing_extensions import _TypedDictMeta, cast # type: ignore
9
9
  from stdlib_list import stdlib_list
10
10
  from pydantic import TypeAdapter
11
11
  from importlib.metadata import packages_distributions
@@ -318,7 +318,7 @@ def _parse_value(value):
318
318
  return None
319
319
 
320
320
 
321
- def parse_function_code(code: str, name: Optional[str] = "", context: Optional[str] = ""):
321
+ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[str] = ""): # noqa: C901
322
322
  schemas = _get_schemas(code)
323
323
 
324
324
  # 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
326
326
  # see https://stackoverflow.com/a/75144378
327
327
  pip_name_lookup = packages_distributions()
328
328
 
329
- deployable: DeployableRecord = {
330
- "context": context,
331
- "name": name,
329
+ deployable: DeployableRecord = { # type: ignore
330
+ "context": context, # type: ignore
331
+ "name": name, # type: ignore
332
332
  "description": "",
333
333
  "config": {},
334
334
  "gitRevision": "",
@@ -382,7 +382,7 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
382
382
  if node.annotation.id == "PolyServerFunction":
383
383
  deployable["type"] = "server-function"
384
384
  elif node.annotation.id == "PolyClientFunction":
385
- deployable["type"] = "server-function"
385
+ deployable["type"] = "client-function"
386
386
  else:
387
387
  print_red("ERROR")
388
388
  print(f"Unsupported polyConfig type '${node.annotation.id}'")
@@ -405,6 +405,7 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
405
405
  if type(docstring) is None or (not docstring and '"""' not in self._lines[start_lineno] and "'''" not in self._lines[start_lineno]):
406
406
  return None
407
407
 
408
+ docstring = cast(str, docstring)
408
409
 
409
410
  # Support both types of triple quotation marks
410
411
  pattern = '"""'
polyapi/poly_schemas.py CHANGED
@@ -8,6 +8,8 @@ from .typedefs import SchemaSpecDto
8
8
 
9
9
  SCHEMA_CODE_IMPORTS = """from typing_extensions import TypedDict, NotRequired
10
10
 
11
+ __all__ = []
12
+
11
13
 
12
14
  """
13
15
 
@@ -42,7 +44,7 @@ def add_schema_file(
42
44
  # add function to init
43
45
  init_path = os.path.join(full_path, "__init__.py")
44
46
  with open(init_path, "a") as f:
45
- f.write(f"\n\nfrom ._{to_func_namespace(schema_name)} import {schema_name}")
47
+ f.write(f"\n\nfrom ._{to_func_namespace(schema_name)} import {schema_name}\n__all__.append('{schema_name}')\n")
46
48
 
47
49
  # add type_defs to underscore file
48
50
  file_path = os.path.join(full_path, f"_{to_func_namespace(schema_name)}.py")
@@ -75,7 +77,6 @@ def create_schema(
75
77
  add_import_to_init(full_path, next)
76
78
 
77
79
 
78
-
79
80
  def add_schema_to_init(full_path: str, spec: SchemaSpecDto):
80
81
  init_the_init(full_path, code_imports="")
81
82
  init_path = os.path.join(full_path, "__init__.py")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.3.dev5
3
+ Version: 0.3.3.dev7
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -12,8 +12,8 @@ polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
12
12
  polyapi/execute.py,sha256=kXnvlNQ7nz9cRlV2_5gXH09UCmyiDP5zi3wiAw0uDuk,1943
13
13
  polyapi/function_cli.py,sha256=htgmcx_dPmw4_5NKRgIivcwS7D8bkOsxCTOrJhzV3pU,3989
14
14
  polyapi/generate.py,sha256=IIbU4Kc8Ut-N3cPI1qzgV3M4r_GHi39dgU0ngpUY86Q,10473
15
- polyapi/parser.py,sha256=eI_FnLY45m0d7caXyWfzrgw9Oh6JgpooJheorTQ4KDE,20264
16
- polyapi/poly_schemas.py,sha256=vHHRUJUycYk4uKmjiWG6fpVQllaRw8yVUt4X_Hmoqk8,2921
15
+ polyapi/parser.py,sha256=5YWkZX7XT3tR3_qlUmtSNwh6bU6cf2Xly2DclfuKUiE,20376
16
+ polyapi/poly_schemas.py,sha256=KFVmpB047pWQaTkiCJ3A9sUTNplTS8JETon1Sm2lnQs,2969
17
17
  polyapi/prepare.py,sha256=Q8CWV4kmZ2dbXYVsud34AgJkj5ymcQ_IcYhLuikc9yk,6659
18
18
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  polyapi/rendered_spec.py,sha256=uaNzBhP4cX7iGfKwzZv0dxMagWzsGeDr0cQYx_AyIhQ,2153
@@ -24,8 +24,8 @@ polyapi/typedefs.py,sha256=KniVl7vwcDOhgAJmHSgTJKkP0rKWvSLIPOGsWuf9jRU,2239
24
24
  polyapi/utils.py,sha256=9OKwhte_YdnkDectgnjSkVmcxazd8FyfoiKCQtlD63o,10194
25
25
  polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
26
26
  polyapi/webhook.py,sha256=LWv28c2MLz_OKBI_Nn7WR4C-gs1SWgbdXsoxIIf-9UI,4886
27
- polyapi_python-0.3.3.dev5.dist-info/licenses/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
28
- polyapi_python-0.3.3.dev5.dist-info/METADATA,sha256=zbtIdrk07PowN5ClzpSvR9qyOsHi3WW7NDSh0IBYaJI,5782
29
- polyapi_python-0.3.3.dev5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
30
- polyapi_python-0.3.3.dev5.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
- polyapi_python-0.3.3.dev5.dist-info/RECORD,,
27
+ polyapi_python-0.3.3.dev7.dist-info/licenses/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
28
+ polyapi_python-0.3.3.dev7.dist-info/METADATA,sha256=AURpnRIR6Nbp114kj19ypXbSk0KWvqZfZ0Hj_6Jrbhg,5782
29
+ polyapi_python-0.3.3.dev7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
30
+ polyapi_python-0.3.3.dev7.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
+ polyapi_python-0.3.3.dev7.dist-info/RECORD,,