libentry 1.14__py3-none-any.whl → 1.16__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
@@ -214,12 +214,12 @@ class APIClient:
214
214
 
215
215
  def get(
216
216
  self,
217
- path: str,
217
+ path: Optional[str] = None, *,
218
218
  num_trials: int = 5,
219
219
  retry_factor: float = 2,
220
220
  timeout: float = 15
221
221
  ):
222
- full_url = urljoin(self.base_url, path) if self.base_url else path
222
+ full_url = urljoin(self.base_url, path)
223
223
  response = self._request(
224
224
  "get",
225
225
  url=full_url,
@@ -242,7 +242,7 @@ class APIClient:
242
242
 
243
243
  def post(
244
244
  self,
245
- path: str,
245
+ path: Optional[str] = None,
246
246
  json_data: Optional[Mapping] = None, *,
247
247
  stream: bool = False,
248
248
  exhaust_stream: bool = False,
@@ -254,7 +254,7 @@ class APIClient:
254
254
  chunk_suffix: str = None,
255
255
  error_prefix: str = "ERROR: "
256
256
  ):
257
- full_url = urljoin(self.base_url, path) if self.base_url else path
257
+ full_url = urljoin(self.base_url, path)
258
258
 
259
259
  headers = {**self.headers}
260
260
  headers["Accept"] = headers["Accept"] + f"; stream={int(stream)}"
libentry/schema.py CHANGED
@@ -87,7 +87,7 @@ def _parse_dict(context: ParseContext):
87
87
  key_type = "str"
88
88
  value_type = parse_type(dict_args[1], context.schemas)
89
89
  if isinstance(value_type, list):
90
- raise TypeError("\"Union\" cannot be used as the type of list elements.")
90
+ raise TypeError("\"Union\" cannot be used as the type of dict elements.")
91
91
  return f"Dict[{key_type},{value_type}]"
92
92
  else:
93
93
  return "Dict"
@@ -130,12 +130,16 @@ def _parse_base_model(context: ParseContext):
130
130
  assert isinstance(fields, Mapping)
131
131
  for name, field in fields.items():
132
132
  try:
133
+ default = field.default if field.default is not PydanticUndefined else None
134
+ title = field.title
135
+ if title is None:
136
+ title = "".join(word.capitalize() for word in name.split("_"))
133
137
  schema_field = SchemaField(
134
138
  name=name,
135
139
  type=parse_type(field.annotation, context.schemas),
136
- default=field.default if field.default is not PydanticUndefined else None,
140
+ default=default,
137
141
  is_required=field.is_required(),
138
- title="".join(word.capitalize() for word in name.split("_")),
142
+ title=title,
139
143
  description=field.description
140
144
  )
141
145
  except TypeError as e:
libentry/service/flask.py CHANGED
@@ -261,6 +261,11 @@ class FlaskServer(Flask):
261
261
  for fn, api_info in list_api_info(self):
262
262
  method = api_info.method
263
263
  path = api_info.path
264
+
265
+ if any(api_info.path == a.path for _, a in self.api_info_list):
266
+ logger.info(f"Use custom implementation of {path}.")
267
+ continue
268
+
264
269
  if asyncio.iscoroutinefunction(fn):
265
270
  logger.error(f"Async function \"{fn.__name__}\" is not supported.")
266
271
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libentry
3
- Version: 1.14
3
+ Version: 1.16
4
4
  Summary: Entries for experimental utilities.
5
5
  Home-page: https://github.com/XoriieInpottn/libentry
6
6
  Author: xi
@@ -1,23 +1,23 @@
1
1
  libentry/__init__.py,sha256=rDBip9M1Xb1N4wMKE1ni_DldrQbkRjp8DxPkTp3K2qo,170
2
- libentry/api.py,sha256=OZ-KZvSV2sWHshYB6vgS-qIu1P6bdfqcMCrOQs-_RwA,10114
2
+ libentry/api.py,sha256=zvW4YugZ7k0wmVVFTnOYHgNqWQPf8zTTPYOnED-iUJM,10097
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=1-Kv5ZRb5dBrOTU84n6sZtYZV3xE-O6wEt_--ynbSaU,1209
8
8
  libentry/logging.py,sha256=IiYoCUzm8XTK1fduA-NA0FI2Qz_m81NEPV3d3tEfgdI,1349
9
- libentry/schema.py,sha256=zXqRsz9-29WdjVFJAJ4qJPyGerzRApHviMxfB1dE6bM,8024
9
+ libentry/schema.py,sha256=BO7EE7i43Cb4xn_OLsBM-HDwWOT6V5fPs91Am3QqnNQ,8178
10
10
  libentry/server.py,sha256=gYPoZXd0umlDYZf-6ZV0_vJadg3YQvnLDc6JFDJh9jc,1503
11
11
  libentry/service/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
12
12
  libentry/service/common.py,sha256=OVaW2afgKA6YqstJmtnprBCqQEUZEWotZ6tHavmJJeU,42
13
- libentry/service/flask.py,sha256=0sYFI8TJY65AEs-gNJdoKqg8_eWk4rSOfKMPauzHQLc,12550
13
+ libentry/service/flask.py,sha256=obFIfm7WVNr_wQsUDO9zFMH2RbfqPHAeqQq9vCpiyWg,12722
14
14
  libentry/service/list.py,sha256=ElHWhTgShGOhaxMUEwVbMXos0NQKjHsODboiQ-3AMwE,1397
15
15
  libentry/service/running.py,sha256=FrPJoJX6wYxcHIysoatAxhW3LajCCm0Gx6l7__6sULQ,5105
16
16
  libentry/service/start.py,sha256=mZT7b9rVULvzy9GTZwxWnciCHgv9dbGN2JbxM60OMn4,1270
17
17
  libentry/service/stop.py,sha256=wOpwZgrEJ7QirntfvibGq-XsTC6b3ELhzRW2zezh-0s,1187
18
- libentry-1.14.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- libentry-1.14.dist-info/METADATA,sha256=rJKa26tvjSA1n7BQRQxGUnekJEROocjRIhpNAv8pTfM,791
20
- libentry-1.14.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
21
- libentry-1.14.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
22
- libentry-1.14.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
23
- libentry-1.14.dist-info/RECORD,,
18
+ libentry-1.16.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
+ libentry-1.16.dist-info/METADATA,sha256=5EyO2Vs582BzElenZhG1qs7ccPV4-4GRoR7OS9Ctnxk,791
20
+ libentry-1.16.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
21
+ libentry-1.16.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
22
+ libentry-1.16.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
23
+ libentry-1.16.dist-info/RECORD,,