libentry 1.24.4__py3-none-any.whl → 1.24.5__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/argparse.py +11 -3
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/METADATA +1 -1
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/RECORD +8 -8
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/LICENSE +0 -0
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/WHEEL +0 -0
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/entry_points.txt +0 -0
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/top_level.txt +0 -0
- {libentry-1.24.4.dist-info → libentry-1.24.5.dist-info}/zip-safe +0 -0
libentry/argparse.py
CHANGED
@@ -126,7 +126,7 @@ class ArgumentParser(argparse.ArgumentParser):
|
|
126
126
|
self.schema_dict[name] = (schema, default)
|
127
127
|
self._add_schema(name, schema)
|
128
128
|
|
129
|
-
def _add_schema(self, prefix: str, schema: Type[BaseModel]):
|
129
|
+
def _add_schema(self, prefix: str, schema: Type[BaseModel], instance: Optional[BaseModel] = None):
|
130
130
|
model_fields = schema.model_fields
|
131
131
|
assert isinstance(model_fields, dict)
|
132
132
|
for name, info in model_fields.items():
|
@@ -145,13 +145,21 @@ class ArgumentParser(argparse.ArgumentParser):
|
|
145
145
|
nested = True
|
146
146
|
break
|
147
147
|
|
148
|
+
default_value = info.default
|
149
|
+
if isinstance(instance, schema):
|
150
|
+
default_value = getattr(instance, name, None)
|
151
|
+
|
148
152
|
if nested:
|
149
|
-
self._add_schema(
|
153
|
+
self._add_schema(
|
154
|
+
f"{prefix}.{name}",
|
155
|
+
schema=anno,
|
156
|
+
instance=default_value
|
157
|
+
)
|
150
158
|
else:
|
151
159
|
self.add_argument(
|
152
160
|
f"--{prefix}.{name}",
|
153
161
|
type=literal_eval,
|
154
|
-
default=DefaultValue(
|
162
|
+
default=DefaultValue(default_value),
|
155
163
|
# required=info.is_required(),
|
156
164
|
help=info.description
|
157
165
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
libentry/__init__.py,sha256=ko2YBIIx5H3dD0tedBkialzJGEDczFaP_PZmT1cIlak,148
|
2
2
|
libentry/api.py,sha256=UkXdBv9oqQhaSESRReLWEPj8venBUoCBppIg-FAXqKA,24146
|
3
|
-
libentry/argparse.py,sha256=
|
3
|
+
libentry/argparse.py,sha256=j_wv7rBE_9TFgxnR6zJtdUkugKP8vOwwIMkL-RaHRsw,7901
|
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
|
@@ -22,10 +22,10 @@ libentry/service/list.py,sha256=ElHWhTgShGOhaxMUEwVbMXos0NQKjHsODboiQ-3AMwE,1397
|
|
22
22
|
libentry/service/running.py,sha256=FrPJoJX6wYxcHIysoatAxhW3LajCCm0Gx6l7__6sULQ,5105
|
23
23
|
libentry/service/start.py,sha256=mZT7b9rVULvzy9GTZwxWnciCHgv9dbGN2JbxM60OMn4,1270
|
24
24
|
libentry/service/stop.py,sha256=wOpwZgrEJ7QirntfvibGq-XsTC6b3ELhzRW2zezh-0s,1187
|
25
|
-
libentry-1.24.
|
26
|
-
libentry-1.24.
|
27
|
-
libentry-1.24.
|
28
|
-
libentry-1.24.
|
29
|
-
libentry-1.24.
|
30
|
-
libentry-1.24.
|
31
|
-
libentry-1.24.
|
25
|
+
libentry-1.24.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
26
|
+
libentry-1.24.5.dist-info/METADATA,sha256=Up8a5KSfalbtpaRZs1s8fo9uNDbYU7GfdEacO49v2QM,1135
|
27
|
+
libentry-1.24.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
28
|
+
libentry-1.24.5.dist-info/entry_points.txt,sha256=1v_nLVDsjvVJp9SWhl4ef2zZrsLTBtFWgrYFgqvQBgc,61
|
29
|
+
libentry-1.24.5.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
|
30
|
+
libentry-1.24.5.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
31
|
+
libentry-1.24.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|