polyapi-python 0.3.14.dev4__tar.gz → 0.3.15__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.14.dev4/polyapi_python.egg-info → polyapi_python-0.3.15}/PKG-INFO +1 -1
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/schema.py +23 -4
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15/polyapi_python.egg-info}/PKG-INFO +1 -1
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/pyproject.toml +1 -1
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_schema.py +8 -1
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/LICENSE +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/README.md +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/__init__.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/__main__.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/api.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/auth.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/cli.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/cli_constants.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/client.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/config.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/constants.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/deployables.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/execute.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/function_cli.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/generate.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/http_client.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/parser.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/poly_schemas.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/poly_tables.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/prepare.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/py.typed +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/rendered_spec.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/server.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/sync.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/utils.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/variables.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi/webhook.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/setup.cfg +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_api.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_async_proof.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_auth.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_deployables.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_generate.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_parser.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_poly_custom.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_rendered_spec.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_server.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_tabi.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_utils.py +0 -0
- {polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/tests/test_variables.py +0 -0
|
@@ -101,8 +101,11 @@ def generate_schema_types(input_data: Dict, root=None):
|
|
|
101
101
|
return output
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
#
|
|
105
|
-
|
|
104
|
+
# Matches commented example headers emitted by jsonschema-gentypes before a raw
|
|
105
|
+
# multiline JSON object/array body that is not commented out.
|
|
106
|
+
MALFORMED_EXAMPLE_HEADER_PATTERN = re.compile(
|
|
107
|
+
r"^\s*#\s*(?:\|\s*)?example:\s*([\[{])\s*$"
|
|
108
|
+
)
|
|
106
109
|
|
|
107
110
|
# Regex to fix invalid escape sequences in docstrings
|
|
108
111
|
INVALID_ESCAPE_PATTERNS = [
|
|
@@ -117,8 +120,24 @@ def clean_malformed_examples(example: str) -> str:
|
|
|
117
120
|
""" there is a bug in the `jsonschmea_gentypes` library where if an example from a jsonchema is an object,
|
|
118
121
|
it will break the code because the object won't be properly commented out. Also fixes invalid escape sequences.
|
|
119
122
|
"""
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
cleaned_lines = []
|
|
124
|
+
balance = 0
|
|
125
|
+
skipping_example = False
|
|
126
|
+
|
|
127
|
+
for line in example.splitlines(keepends=True):
|
|
128
|
+
if not skipping_example:
|
|
129
|
+
if MALFORMED_EXAMPLE_HEADER_PATTERN.match(line):
|
|
130
|
+
skipping_example = True
|
|
131
|
+
balance = line.count("{") + line.count("[") - line.count("}") - line.count("]")
|
|
132
|
+
continue
|
|
133
|
+
cleaned_lines.append(line)
|
|
134
|
+
continue
|
|
135
|
+
|
|
136
|
+
balance += line.count("{") + line.count("[") - line.count("}") - line.count("]")
|
|
137
|
+
if balance <= 0:
|
|
138
|
+
skipping_example = False
|
|
139
|
+
|
|
140
|
+
cleaned_example = "".join(cleaned_lines)
|
|
122
141
|
|
|
123
142
|
# Fix invalid escape sequences in docstrings
|
|
124
143
|
for pattern, replacement in INVALID_ESCAPE_PATTERNS:
|
|
@@ -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.15"
|
|
8
8
|
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
|
|
9
9
|
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
|
|
10
10
|
dependencies = [
|
|
@@ -19,6 +19,7 @@ CHARACTER_SCHEMA = {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
APALEO_MALFORMED_EXAMPLE = 'from typing import List, TypedDict, Union\nfrom typing_extensions import Required\n\n\n# Body.\n# \n# example: {\n "from": "2024-04-21",\n "to": "2024-04-24",\n "grossDailyRate": {\n "amount": 160.0,\n "currency": "EUR"\n },\n "timeSlices": [\n {\n "blockedUnits": 3\n },\n {\n "blockedUnits": 0\n },\n {\n "blockedUnits": 7\n }\n ]\n}\n# x-readme-ref-name: ReplaceBlockModel\nBody = TypedDict(\'Body\', {\n # Start date and time from which the inventory will be blockedSpecify either a pure date or a date and time (without fractional second part) in UTC or with UTC offset as defined in <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601:2004</a>\n # \n # Required property\n \'from\': Required[str],\n # End date and time until which the inventory will be blocked. Cannot be more than 5 years after the start date.Specify either a pure date or a date and time (without fractional second part) in UTC or with UTC offset as defined in <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601:2004</a>\n # \n # Required property\n \'to\': Required[str],\n # x-readme-ref-name: MonetaryValueModel\n # \n # Required property\n \'grossDailyRate\': Required["_BodygrossDailyRate"],\n # The list of time slices\n # \n # Required property\n \'timeSlices\': Required[List["_BodytimeSlicesitem"]],\n}, total=False)\n\n\nclass _BodygrossDailyRate(TypedDict, total=False):\n """ x-readme-ref-name: MonetaryValueModel """\n\n amount: Required[Union[int, float]]\n """\n format: double\n\n Required property\n """\n\n currency: Required[str]\n """ Required property """\n\n\n\nclass _BodytimeSlicesitem(TypedDict, total=False):\n """ x-readme-ref-name: CreateBlockTimeSliceModel """\n\n blockedUnits: Required[Union[int, float]]\n """\n Number of units blocked for the time slice\n\n format: int32\n\n Required property\n """\n\n'
|
|
22
|
+
APALEO_MALFORMED_PIPE_EXAMPLE = APALEO_MALFORMED_EXAMPLE.replace("# example: {", "# | example: {")
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class T(unittest.TestCase):
|
|
@@ -32,9 +33,15 @@ class T(unittest.TestCase):
|
|
|
32
33
|
def test_clean_malformed_examples(self):
|
|
33
34
|
output = clean_malformed_examples(APALEO_MALFORMED_EXAMPLE)
|
|
34
35
|
self.assertNotIn("# example: {", output)
|
|
36
|
+
self.assertNotIn(' "from": "2024-04-21",', output)
|
|
37
|
+
|
|
38
|
+
def test_clean_malformed_examples_pipe_style(self):
|
|
39
|
+
output = clean_malformed_examples(APALEO_MALFORMED_PIPE_EXAMPLE)
|
|
40
|
+
self.assertNotIn("# | example: {", output)
|
|
41
|
+
self.assertNotIn(' "from": "2024-04-21",', output)
|
|
35
42
|
|
|
36
43
|
def test_character_encoding(self):
|
|
37
44
|
output = generate_schema_types(CHARACTER_SCHEMA, "Dict")
|
|
38
45
|
expected = 'from typing import TypedDict\n\n\nclass Dict(TypedDict, total=False):\n CHARACTER_SCHEMA_NAME: str\n """ This is — “bad”, right? """\n\n'
|
|
39
46
|
self.assertEqual(output, expected)
|
|
40
|
-
|
|
47
|
+
|
|
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
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.14.dev4 → polyapi_python-0.3.15}/polyapi_python.egg-info/dependency_links.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|