polyapi-python 0.3.2.dev1__py3-none-any.whl → 0.3.2.dev2__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/deployables.py CHANGED
@@ -245,7 +245,7 @@ def update_deployment_comments(file_content: str, deployable: dict) -> str:
245
245
  if deployable['deployments']:
246
246
  deployment_comments = write_deploy_comments(deployable['deployments'])
247
247
  deployable['deploymentCommentRanges'] = [(0, len(deployment_comments) + 1)]
248
- file_content = f"{deployment_comments}{file_content}"
248
+ file_content = f"{deployment_comments}\n{file_content}"
249
249
  return file_content
250
250
 
251
251
  def update_deployable_function_comments(file_content: str, deployable: dict, disable_docs: bool = False) -> str:
polyapi/function_cli.py CHANGED
@@ -55,7 +55,6 @@ def function_add_or_update(
55
55
  "code": code,
56
56
  "language": "python",
57
57
  "returnType": get_jsonschema_type(return_type),
58
- "returnTypeSchema": parsed["types"]["returns"]["typeSchema"],
59
58
  "arguments": [{**p, "key": p["name"], "type": get_jsonschema_type(p["type"]) } for p in parsed["types"]["params"]],
60
59
  "logsEnabled": logs_enabled,
61
60
  }
polyapi/parser.py CHANGED
@@ -181,7 +181,7 @@ def _get_schemas(code: str) -> List[Dict]:
181
181
 
182
182
  def get_jsonschema_type(python_type: str):
183
183
  if python_type == "Any":
184
- return "Any"
184
+ return "any"
185
185
 
186
186
  if python_type == "List":
187
187
  return "array"
@@ -338,6 +338,7 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
338
338
  "params": [],
339
339
  "returns": {
340
340
  "type": "",
341
+ "typeSchema": None,
341
342
  "description": "",
342
343
  }
343
344
  },
@@ -435,13 +436,14 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
435
436
 
436
437
  def _extract_deploy_comments(self):
437
438
  for i in range(len(self._lines)):
438
- line = self._lines[i].strip()
439
+ line = self._lines[i]
439
440
  if line and not line.startswith("#"):
440
441
  return
441
- deployment = _parse_deploy_comment(line)
442
+ deployment = _parse_deploy_comment(line.strip())
442
443
  if deployment:
444
+ start = self._line_offsets[i]
443
445
  deployable["deployments"].append(deployment)
444
- deployable["deploymentCommentRanges"].append([self._line_offsets[i], len(line)])
446
+ deployable["deploymentCommentRanges"].append([start, start + len(line)])
445
447
 
446
448
  def visit_Import(self, node: ast.Import):
447
449
  # TODO maybe handle `import foo.bar` case?
@@ -471,8 +473,7 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
471
473
  "type": python_type,
472
474
  "description": "",
473
475
  }
474
- if type_schema:
475
- json_arg["typeSchema"] = json.dumps(type_schema)
476
+ json_arg["typeSchema"] = json.dumps(type_schema) if type_schema else None
476
477
 
477
478
  if docstring_params:
478
479
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.3.2.dev1
3
+ Version: 0.3.2.dev2
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
@@ -6,13 +6,13 @@ polyapi/cli.py,sha256=w0SOiRHR7gJRoEwkfyGC1sdBT76sgx8MUcF8_GnGuJU,8324
6
6
  polyapi/client.py,sha256=CoFDYvyKsqL4wPQbUDIr0Qb8Q5eD92xN4OEEcJEVuGQ,1296
7
7
  polyapi/config.py,sha256=uvEvOfWYZTLmBmZX-5jJxCzWPpwzVmEOIiQIdi98P4Y,3015
8
8
  polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
9
- polyapi/deployables.py,sha256=74Bs2kDhyoQhezc0I1V4pi7l-SYg7_zpYrXYPjAePMw,11954
9
+ polyapi/deployables.py,sha256=qKoyuPUv46yZoLBvSOmk6JsBWqomwJAkadhItp8Lx40,11956
10
10
  polyapi/error_handler.py,sha256=I_e0iz6VM23FLVQWJljxs2NGcl_OODbi43OcbnqBlp8,2398
11
11
  polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
12
12
  polyapi/execute.py,sha256=kXnvlNQ7nz9cRlV2_5gXH09UCmyiDP5zi3wiAw0uDuk,1943
13
- polyapi/function_cli.py,sha256=s4ds6-5ePbaDxZSvQ8BwkM7TwFEQJn-54UzoxZxBtuc,4255
13
+ polyapi/function_cli.py,sha256=-Fjv_DECZB5LK8rT222B62GPw4vksAi7KsIqT-ss5FM,4185
14
14
  polyapi/generate.py,sha256=SIRfN7RF3Z7eQ8kSNg4H70LeT7Hmh-Mn5maibvM7kAM,7969
15
- polyapi/parser.py,sha256=rtI4-SR6v7mqG2vF_P6qgC-qn-M_QG-e95PJUZv92cc,20248
15
+ polyapi/parser.py,sha256=noi3Tjf1vVNm5gjTzgvOlJ6IMaoZ9DheklibVWfPPhk,20311
16
16
  polyapi/prepare.py,sha256=Q8CWV4kmZ2dbXYVsud34AgJkj5ymcQ_IcYhLuikc9yk,6659
17
17
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  polyapi/rendered_spec.py,sha256=uaNzBhP4cX7iGfKwzZv0dxMagWzsGeDr0cQYx_AyIhQ,2153
@@ -23,8 +23,8 @@ polyapi/typedefs.py,sha256=U0i30Y9CgoUBWeMUbpM28S8eVOEU9NfdckK1VAop3A0,1994
23
23
  polyapi/utils.py,sha256=jzCh-ivKMcgp5fIXynhYmP9UyzsISr9bGGEzdPP8n3w,7644
24
24
  polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
25
25
  polyapi/webhook.py,sha256=LWv28c2MLz_OKBI_Nn7WR4C-gs1SWgbdXsoxIIf-9UI,4886
26
- polyapi_python-0.3.2.dev1.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
27
- polyapi_python-0.3.2.dev1.dist-info/METADATA,sha256=-1ed_fSmkmHnDkBP99vXwDBnhQPZKTiBavXQvKgSWRE,5326
28
- polyapi_python-0.3.2.dev1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
29
- polyapi_python-0.3.2.dev1.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
30
- polyapi_python-0.3.2.dev1.dist-info/RECORD,,
26
+ polyapi_python-0.3.2.dev2.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
27
+ polyapi_python-0.3.2.dev2.dist-info/METADATA,sha256=YKwIhWvsJJ3qnsGIa1LqH7fu86jCs2a9pA5lrBtzfF8,5326
28
+ polyapi_python-0.3.2.dev2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
29
+ polyapi_python-0.3.2.dev2.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
30
+ polyapi_python-0.3.2.dev2.dist-info/RECORD,,