flinventory 0.3.0__py3-none-any.whl → 0.3.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.
@@ -103,8 +103,8 @@ class Inventory(list[BoxedThing]):
103
103
  things_directory = os.path.join(self._directory, constant.THING_DIRECTORY)
104
104
  os.makedirs(things_directory, exist_ok=True)
105
105
  while (
106
- thing_id := random.choices(
107
- population="abcdefghijklmnopqrstuvwxyz0123456789", k=5
106
+ thing_id := "".join(
107
+ random.choices(population="abcdefghijklmnopqrstuvwxyz0123456789", k=5)
108
108
  )
109
109
  ) in os.listdir(things_directory):
110
110
  pass
flinventory/location.py CHANGED
@@ -384,6 +384,7 @@ class Location(dict[str, Value]):
384
384
  """Save location data to yaml file."""
385
385
  path = pathlib.Path(os.path.join(self._directory, constant.LOCATION_FILE))
386
386
  if len(self) > 0: # not empty?
387
+ os.makedirs(self._directory, exist_ok=True)
387
388
  with open(path, mode="w", encoding="utf-8") as location_file:
388
389
  yaml.dump(
389
390
  data=self.to_jsonable_data(),
flinventory/sign.py CHANGED
@@ -38,10 +38,12 @@ class Sign(defaulted_data.DefaultedDict):
38
38
  If None, it not saved. (Can be set later to save.)
39
39
  """
40
40
  self._directory = None # to avoid saving during initialisation
41
- for source, target in [("fontsize_de", ("fontsize", "de")),
42
- ("fontsize_en", ("fontsize", "en")),
43
- ("fontsize_main", ("fontsize", "de")),
44
- ("fontsize_secondary", ("fontsize", "en"))]:
41
+ for source, target in [
42
+ ("fontsize_de", ("fontsize", "de")),
43
+ ("fontsize_en", ("fontsize", "en")),
44
+ ("fontsize_main", ("fontsize", "de")),
45
+ ("fontsize_secondary", ("fontsize", "en")),
46
+ ]:
45
47
  try:
46
48
  data[target] = data[source]
47
49
  del data[source]
@@ -117,6 +119,7 @@ class Sign(defaulted_data.DefaultedDict):
117
119
  self._logger.info(f"Delete {path}")
118
120
  path.unlink(missing_ok=True)
119
121
  else:
122
+ os.makedirs(self._directory, exist_ok=True)
120
123
  with open(path, mode="w", encoding="utf-8") as sign_file:
121
124
  yaml.dump(
122
125
  self.to_jsonable_data(), sign_file, **constant.YAML_DUMP_OPTIONS
flinventory/thing.py CHANGED
@@ -93,10 +93,10 @@ class Thing(defaulted_data.DefaultedDict):
93
93
  Is relative path if my directory is relative.
94
94
  None if no image was found.
95
95
  """
96
- path_base = self.get('image', constant.IMAGE_FILE_BASE)
96
+ path_base = self.get("image", constant.IMAGE_FILE_BASE)
97
97
  if not os.path.isabs(path_base):
98
98
  path_base = os.path.join(self.directory, path_base)
99
- for extension in ('', *(f".{ext}" for ext in constant.IMAGE_FILE_TYPES)):
99
+ for extension in ("", *(f".{ext}" for ext in constant.IMAGE_FILE_TYPES)):
100
100
  if os.path.isfile(path := path_base + extension):
101
101
  return path
102
102
  return None
@@ -138,6 +138,7 @@ class Thing(defaulted_data.DefaultedDict):
138
138
  self._logger.info(f"Delete {path}")
139
139
  path.unlink(missing_ok=True)
140
140
  else:
141
+ os.makedirs(self._directory, exist_ok=True)
141
142
  with open(path, mode="w", encoding="utf-8") as thing_file:
142
143
  yaml.dump(jsonable_data, thing_file, **constant.YAML_DUMP_OPTIONS)
143
144
  self._logger.info(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flinventory
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: An inventory system for self-help repair shops
5
5
  Author-Email: flukx <flinventory-flukx@612211124.xyz>
6
6
  License: GPL3
@@ -1,7 +1,7 @@
1
- flinventory-0.3.0.dist-info/METADATA,sha256=tiCptZreASgWU6jgMKWoK-iZbLjgBMg13xCNjoZi56k,4439
2
- flinventory-0.3.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- flinventory-0.3.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- flinventory-0.3.0.dist-info/licenses/LICENSE,sha256=9c-AWlAEeFMmn1aODEfabsw2he-SpQeykurYw-KqSdw,34478
1
+ flinventory-0.3.2.dist-info/METADATA,sha256=j-huk4wILTl7PYAmUVaKGQzT5c7Nj5bIBS_BlGzaxGM,4439
2
+ flinventory-0.3.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ flinventory-0.3.2.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ flinventory-0.3.2.dist-info/licenses/LICENSE,sha256=9c-AWlAEeFMmn1aODEfabsw2he-SpQeykurYw-KqSdw,34478
5
5
  flinventory/__init__.py,sha256=0HTGxw9J-2KnbxQbzX6HH-Pztkp0BEjiHANhndfbtYM,270
6
6
  flinventory/__main__.py,sha256=YI3dGiBr1i56JpGommQTWYjgfCmhr2JT1pQUdf0lf1w,1228
7
7
  flinventory/box.py,sha256=rk7yrAjVdxcrpvmTMt3jkMVOAoQNJfqoSig9U2S3yJ0,10480
@@ -9,15 +9,15 @@ flinventory/constant.py,sha256=pPNCwScLon_MOKL9_jjD_sxqB7Q2WW6rZqtrBl7SyWk,10283
9
9
  flinventory/datacleanup.py,sha256=_CImmWJhq5uKz21jJQUqKYoQfbHEYA0000RyPRt5BI0,11363
10
10
  flinventory/defaulted_data.py,sha256=KAy6V2KLcifLg7zHBFnx_eFLp31sCWih1Btp6cE0bQc,21585
11
11
  flinventory/generate_labels.py,sha256=wB9ibokHOcab599qZhi5uTzfy3DTo3wT4DJP9qLMzXs,6642
12
- flinventory/inventory_io.py,sha256=VDNgbxdo8RzZO-9pQ1FAge28wTDIUNkh5WSft03XwZE,9832
13
- flinventory/location.py,sha256=JhXgLfalGx1mIkzZBVoRXJQ4RHxU2OxmwkNBNcRc6ug,16537
14
- flinventory/sign.py,sha256=FovC0OniBzpRncT1W4npfPV6fYO69xgMhPj2QHu93ik,5493
12
+ flinventory/inventory_io.py,sha256=bC5NjJ2XAVZDPlr4pcJaAyh7TmRV6ELQs1LJOHW2j3U,9841
13
+ flinventory/location.py,sha256=eaZ8tF8HdzH17IBDl3_p_MsnSw5-H1GfbvkTe3dPFGk,16593
14
+ flinventory/sign.py,sha256=8G7fsne3Nsf8zZKKTUl40uWMNsWIv7FYV2KcqBR2MQI,5515
15
15
  flinventory/signprinter_latex.py,sha256=Ytf1T_ADedj_Wkqe8bWyN23-TwFaKE7zFpeoYxn5NzM,19105
16
- flinventory/thing.py,sha256=22syu7fvVu955HpcLWjz8S0JkBvYN_miJa26AmVjzSY,5008
16
+ flinventory/thing.py,sha256=e1PZoS29EmDNVhFoPW1_XGaovai9WthitNalailyfTM,5064
17
17
  flinventory/thingtemplate_latex/.gitignore,sha256=DTF250Ttj8O2lxrQBwMNrQ73rWPvdwCytipfZSLFtlU,51
18
18
  flinventory/thingtemplate_latex/dummyImage.jpg,sha256=bIBH5Lrxlr5qJ42nP1cpJXPRNGLOwyEuzwXFSvNwTSk,147857
19
19
  flinventory/thingtemplate_latex/sign.tex,sha256=cVlOjImuS97Gf19MGW27HiP6Uw8JNnobXym6NlY-qSI,787
20
20
  flinventory/thingtemplate_latex/signlist-footer.tex,sha256=LcZw5__h8SqgMmYxs5oLbXLaFTQlx_X5rtYnpxwUh9Y,14
21
21
  flinventory/thingtemplate_latex/signlist-header.tex,sha256=F1J4aSPq6QO_Ved4Zn7-rytP1vDkdWTqjjtGJpe_FDg,297
22
22
  flinventory/thingtemplate_latex/signs-example.tex,sha256=J6eCcPhP0Xklgn8xnSenDOvjzmc_NGmakWU4RGbeUtM,3090
23
- flinventory-0.3.0.dist-info/RECORD,,
23
+ flinventory-0.3.2.dist-info/RECORD,,