polyapi-python 0.2.3.dev8__py3-none-any.whl → 0.2.3.dev9__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/utils.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import re
2
2
  import os
3
+ import logging
3
4
  from typing import Tuple, List
4
5
  from colorama import Fore, Style
5
6
  from polyapi.constants import BASIC_PYTHON_TYPES
@@ -91,7 +92,11 @@ def get_type_and_def(type_spec: PropertyType) -> Tuple[str, str]:
91
92
  if type_spec.get("items"):
92
93
  items = type_spec["items"]
93
94
  if items.get("$ref"):
94
- return "ResponseType", generate_schema_types(type_spec, root="ResponseType") # type: ignore
95
+ try:
96
+ return "ResponseType", generate_schema_types(type_spec, root="ResponseType") # type: ignore
97
+ except:
98
+ logging.exception(f"Error when generating schema type: {type_spec}")
99
+ return "Dict", ""
95
100
  else:
96
101
  item_type, _ = get_type_and_def(items)
97
102
  title = f"List[{item_type}]"
@@ -108,7 +113,12 @@ def get_type_and_def(type_spec: PropertyType) -> Tuple[str, str]:
108
113
  if title:
109
114
  assert isinstance(title, str)
110
115
  title = clean_title(title)
111
- return title, generate_schema_types(schema, root=title) # type: ignore
116
+ try:
117
+ return title, generate_schema_types(schema, root=title) # type: ignore
118
+ except:
119
+ logging.exception(f"Error when generating schema type: {schema}")
120
+ return "Dict", ""
121
+
112
122
  elif schema.get("items"):
113
123
  # fallback to schema $ref name if no explicit title
114
124
  items = schema.get("items") # type: ignore
@@ -123,7 +133,11 @@ def get_type_and_def(type_spec: PropertyType) -> Tuple[str, str]:
123
133
  return "List", ""
124
134
 
125
135
  title = f"List[{title}]"
126
- return title, generate_schema_types(schema, root=title)
136
+ try:
137
+ return title, generate_schema_types(schema, root=title)
138
+ except:
139
+ logging.exception(f"Error when generating schema type: {schema}")
140
+ return "List", ""
127
141
  else:
128
142
  return "Any", ""
129
143
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.3.dev8
3
+ Version: 0.2.3.dev9
4
4
  Summary: The PolyAPI Python Client
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -15,11 +15,11 @@ polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  polyapi/schema.py,sha256=1a7nIO867Xy3bagmPUNdYMxtS5OoCAv8oKIbYgj55dk,2957
16
16
  polyapi/server.py,sha256=mcbH8pG16fFMiFL52wdii0217ZLsznQnElAFEvXZ7IA,2211
17
17
  polyapi/typedefs.py,sha256=a5WfHaAvjeql3y1iA3_SkpUztTbKvS5bPqkVxkCvr9E,1459
18
- polyapi/utils.py,sha256=wZQrwSOst5wyoYYLoMk1DnAEbVsJ0-2YkmmDQ9gI3FY,5399
18
+ polyapi/utils.py,sha256=UD3uV3kzt2w23zxAdHCUROhdvtdO44KCJIpqnFwEhqE,5937
19
19
  polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
20
20
  polyapi/webhook.py,sha256=A89eNnYcVpVe9doJPDLfscIhF-C7Q2AI3vu-SzGxMBg,2923
21
- polyapi_python-0.2.3.dev8.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
22
- polyapi_python-0.2.3.dev8.dist-info/METADATA,sha256=VPnE0GsVdsxYRxM_eG44vzmBwtM0gJtH0NDv8Bzqobo,4823
23
- polyapi_python-0.2.3.dev8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
24
- polyapi_python-0.2.3.dev8.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
25
- polyapi_python-0.2.3.dev8.dist-info/RECORD,,
21
+ polyapi_python-0.2.3.dev9.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
22
+ polyapi_python-0.2.3.dev9.dist-info/METADATA,sha256=3pEducW3Aaun4Vy6JgbJ1SksuPLLbWSMXAlYPyg--4A,4823
23
+ polyapi_python-0.2.3.dev9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
24
+ polyapi_python-0.2.3.dev9.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
25
+ polyapi_python-0.2.3.dev9.dist-info/RECORD,,