flinventory 0.4.3__tar.gz → 0.5.1__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.
- {flinventory-0.4.3 → flinventory-0.5.1}/PKG-INFO +1 -1
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/location.py +9 -3
- {flinventory-0.4.3 → flinventory-0.5.1}/pyproject.toml +1 -1
- {flinventory-0.4.3 → flinventory-0.5.1}/LICENSE +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/README.md +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/__init__.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/__main__.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/box.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/constant.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/datacleanup.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/defaulted_data.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/generate_labels.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/inventory_io.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/sign.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/signprinter_latex.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thing.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/.gitignore +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/dummyImage.jpg +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/sign.tex +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signlist-footer.tex +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signlist-header.tex +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signs-example.tex +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/tests/__init__.py +0 -0
- {flinventory-0.4.3 → flinventory-0.5.1}/tests/test_defaulted_data.py +0 -0
@@ -213,12 +213,13 @@ class Schema:
|
|
213
213
|
).get_schema_hierarchy(location_info)
|
214
214
|
|
215
215
|
def get_valid_subs(
|
216
|
-
self, shortcuts: Literal["yes", "only", "()", "*"] = "yes"
|
216
|
+
self, shortcuts: Literal["yes", "only", "()", "*", "no"] = "yes"
|
217
217
|
) -> Optional[list[Union[str, int]]]:
|
218
218
|
"""A list of valid sub schemas. Usable for suggesting options.
|
219
219
|
|
220
220
|
Args:
|
221
221
|
shortcuts: if valid shortcuts should be listed as well:
|
222
|
+
'no': shortcuts are not listed
|
222
223
|
'yes': shortcuts listed in the same way as names,
|
223
224
|
'only': only shortcuts are listed
|
224
225
|
'()': shortcuts are listed in parentheses after the name (note: result
|
@@ -232,6 +233,8 @@ class Schema:
|
|
232
233
|
return None
|
233
234
|
if self._subs is None:
|
234
235
|
return []
|
236
|
+
if shortcuts == "no":
|
237
|
+
return [sub.name for sub in self._subs]
|
235
238
|
if shortcuts == "yes":
|
236
239
|
return [name for sub in self._subs for name in (sub.name, sub.shortcut)]
|
237
240
|
if shortcuts == "only":
|
@@ -280,6 +283,9 @@ class Location(dict[str, Value]):
|
|
280
283
|
options: global options including the seperator
|
281
284
|
"""
|
282
285
|
|
286
|
+
EMPTY = [None, "", [], {}]
|
287
|
+
"""Values that are considered empty and mean that nothing should be saved."""
|
288
|
+
|
283
289
|
def __init__(
|
284
290
|
self,
|
285
291
|
schema: Schema,
|
@@ -353,11 +359,11 @@ class Location(dict[str, Value]):
|
|
353
359
|
def __setitem__(self, level: str, value: Value) -> None:
|
354
360
|
"""Set one level info.
|
355
361
|
|
356
|
-
Or deletes it if it's None or "" or [] or {}
|
362
|
+
Or deletes it if it's None or "" or [] or {} (see EMPTY)
|
357
363
|
|
358
364
|
Update internal info.
|
359
365
|
"""
|
360
|
-
if value in
|
366
|
+
if value in self.EMPTY:
|
361
367
|
if level in self:
|
362
368
|
del self[level]
|
363
369
|
else:
|
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
|