libentry 1.23__py3-none-any.whl → 1.23.2__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.
libentry/api.py CHANGED
@@ -225,7 +225,7 @@ class BaseClient:
225
225
  verify: bool,
226
226
  ) -> Union[bytes, Iterable[bytes]]:
227
227
  headers = self.headers if headers is None else {**self.headers, **headers}
228
- response = self.URLLIB3_POOL[int(verify)].http_request(
228
+ response = self.URLLIB3_POOL[int(verify)].request(
229
229
  method=method,
230
230
  url=url,
231
231
  body=body,
libentry/schema.py CHANGED
@@ -152,7 +152,8 @@ def _parse_dict(context: ParseContext) -> Optional[str]:
152
152
  key_type = "str"
153
153
  value_type = parse_type(dict_args[1], context.schemas)
154
154
  if isinstance(value_type, list):
155
- raise TypeError("\"Union\" cannot be used as the type of dict elements.")
155
+ value_type = "|".join(value_type)
156
+ # raise TypeError("\"Union\" cannot be used as the type of dict elements.")
156
157
  return f"Dict[{key_type},{value_type}]"
157
158
  else:
158
159
  return "Dict"
@@ -168,7 +169,8 @@ def _parse_list(context: ParseContext) -> Optional[str]:
168
169
  raise TypeError("Only ONE type can be used as the type of list elements.")
169
170
  elem_type = parse_type(list_args[0], context.schemas)
170
171
  if isinstance(elem_type, list):
171
- raise TypeError("\"Union\" cannot be used as the type of list elements.")
172
+ elem_type = "|".join(elem_type)
173
+ # raise TypeError("\"Union\" cannot be used as the type of list elements.")
172
174
  return f"List[{elem_type}]"
173
175
  else:
174
176
  return "List"
@@ -194,6 +196,11 @@ def _parse_base_model(context: ParseContext) -> Optional[str]:
194
196
  is_not_base_class = origin is not BaseModel
195
197
  if is_new_model and is_not_base_class:
196
198
  schema = Schema(name=model_name)
199
+ context.schemas[model_name] = schema
200
+ # Once the Schema object is created, it should be put into the context immediately.
201
+ # This is to prevent this object from being repeatedly parsed.
202
+ # Repeated parsing will cause dead recursion!
203
+
197
204
  fields = origin.model_fields
198
205
  assert isinstance(fields, Mapping)
199
206
  for name, field in fields.items():
@@ -216,7 +223,6 @@ def _parse_base_model(context: ParseContext) -> Optional[str]:
216
223
  if is_dataclass(md):
217
224
  schema_field.metadata.update(asdict(md))
218
225
  schema.fields.append(schema_field)
219
- context.schemas[model_name] = schema
220
226
 
221
227
  return model_name
222
228
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: libentry
3
- Version: 1.23
3
+ Version: 1.23.2
4
4
  Summary: Entries for experimental utilities.
5
5
  Home-page: https://github.com/XoriieInpottn/libentry
6
6
  Author: xi
@@ -1,12 +1,12 @@
1
1
  libentry/__init__.py,sha256=ko2YBIIx5H3dD0tedBkialzJGEDczFaP_PZmT1cIlak,148
2
- libentry/api.py,sha256=lw_XH7GMWxwX7OzN4K5SxBHobjNIT-FNiTcRK60v7Fg,24151
2
+ libentry/api.py,sha256=UkXdBv9oqQhaSESRReLWEPj8venBUoCBppIg-FAXqKA,24146
3
3
  libentry/argparse.py,sha256=NxzXV-jBN51ReZsNs5aeyOfzwYQ5A5nJ95rWoa-FYCs,10415
4
4
  libentry/dataclasses.py,sha256=AQV2PuxplJCwGZ5HKX72U-z-POUhTdy3XtpEK9KNIGQ,4541
5
5
  libentry/executor.py,sha256=cTV0WxJi0nU1TP-cOwmeodN8DD6L1691M2HIQsJtGrU,6582
6
6
  libentry/experiment.py,sha256=ejgAHDXWIe9x4haUzIFuz1WasLY0_aD1z_vyEVGjTu8,4922
7
7
  libentry/json.py,sha256=CubUUu29h7idLaC4d66vKhjBgVHKN1rZOv-Tw2qM17k,1916
8
8
  libentry/logging.py,sha256=IiYoCUzm8XTK1fduA-NA0FI2Qz_m81NEPV3d3tEfgdI,1349
9
- libentry/schema.py,sha256=i-TswY-R7Lw-WY1pFFYBMoEUCPN_tpUMpezlS7nQgIw,10107
9
+ libentry/schema.py,sha256=40SOhCF_eytWOF47MWKCRHKHl_lCaQVetx1Af62PkiI,10439
10
10
  libentry/test_api.py,sha256=Xw7B7sH6g1iCTV5sFzyBF3JAJzeOr9xg0AyezTNsnIk,4452
11
11
  libentry/utils.py,sha256=O7P6GadtUIjq0N2IZH7PhHZDUM3NebzcqyDqytet7CM,683
12
12
  libentry/mcp/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
@@ -21,10 +21,10 @@ libentry/service/list.py,sha256=ElHWhTgShGOhaxMUEwVbMXos0NQKjHsODboiQ-3AMwE,1397
21
21
  libentry/service/running.py,sha256=FrPJoJX6wYxcHIysoatAxhW3LajCCm0Gx6l7__6sULQ,5105
22
22
  libentry/service/start.py,sha256=mZT7b9rVULvzy9GTZwxWnciCHgv9dbGN2JbxM60OMn4,1270
23
23
  libentry/service/stop.py,sha256=wOpwZgrEJ7QirntfvibGq-XsTC6b3ELhzRW2zezh-0s,1187
24
- libentry-1.23.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- libentry-1.23.dist-info/METADATA,sha256=_2SdH3WYDWIH-bs_FzKN3NHzViQKtYFDf7BKVs19WcM,1133
26
- libentry-1.23.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
- libentry-1.23.dist-info/entry_points.txt,sha256=1v_nLVDsjvVJp9SWhl4ef2zZrsLTBtFWgrYFgqvQBgc,61
28
- libentry-1.23.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
29
- libentry-1.23.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
30
- libentry-1.23.dist-info/RECORD,,
24
+ libentry-1.23.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ libentry-1.23.2.dist-info/METADATA,sha256=8Gc8UbjbMnPJn_EUsJoYzJRHOCOxVWcLVPGvi_wwKSs,1135
26
+ libentry-1.23.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
+ libentry-1.23.2.dist-info/entry_points.txt,sha256=1v_nLVDsjvVJp9SWhl4ef2zZrsLTBtFWgrYFgqvQBgc,61
28
+ libentry-1.23.2.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
29
+ libentry-1.23.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
30
+ libentry-1.23.2.dist-info/RECORD,,