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.
Files changed (24) hide show
  1. {flinventory-0.4.3 → flinventory-0.5.1}/PKG-INFO +1 -1
  2. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/location.py +9 -3
  3. {flinventory-0.4.3 → flinventory-0.5.1}/pyproject.toml +1 -1
  4. {flinventory-0.4.3 → flinventory-0.5.1}/LICENSE +0 -0
  5. {flinventory-0.4.3 → flinventory-0.5.1}/README.md +0 -0
  6. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/__init__.py +0 -0
  7. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/__main__.py +0 -0
  8. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/box.py +0 -0
  9. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/constant.py +0 -0
  10. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/datacleanup.py +0 -0
  11. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/defaulted_data.py +0 -0
  12. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/generate_labels.py +0 -0
  13. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/inventory_io.py +0 -0
  14. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/sign.py +0 -0
  15. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/signprinter_latex.py +0 -0
  16. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thing.py +0 -0
  17. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/.gitignore +0 -0
  18. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/dummyImage.jpg +0 -0
  19. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/sign.tex +0 -0
  20. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signlist-footer.tex +0 -0
  21. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signlist-header.tex +0 -0
  22. {flinventory-0.4.3 → flinventory-0.5.1}/flinventory/thingtemplate_latex/signs-example.tex +0 -0
  23. {flinventory-0.4.3 → flinventory-0.5.1}/tests/__init__.py +0 -0
  24. {flinventory-0.4.3 → flinventory-0.5.1}/tests/test_defaulted_data.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flinventory
3
- Version: 0.4.3
3
+ Version: 0.5.1
4
4
  Summary: An inventory system for self-help repair shops
5
5
  Author-Email: flukx <flinventory-flukx@612211124.xyz>
6
6
  License: GPL3
@@ -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 [None, "", [], {}]:
366
+ if value in self.EMPTY:
361
367
  if level in self:
362
368
  del self[level]
363
369
  else:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flinventory"
3
- version = "0.4.3"
3
+ version = "0.5.1"
4
4
  description = "An inventory system for self-help repair shops"
5
5
  authors = [
6
6
  { name = "flukx", email = "flinventory-flukx@612211124.xyz" },
File without changes
File without changes