autonomous-app 0.2.22__py3-none-any.whl → 0.2.23__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.
autonomous/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.2.22"
1
+ __version__ = "0.2.23"
2
2
 
3
3
  from .logger import log
4
4
  from .model.automodel import AutoModel
@@ -15,6 +15,12 @@ class ImageStorage:
15
15
  def __init__(self, path="static/images"):
16
16
  self.base_path = path
17
17
 
18
+ def scan_storage(self, path=None):
19
+ for root, dirs, files in os.walk(path or self.base_path):
20
+ for file in files:
21
+ if file == "orig.webp":
22
+ yield os.path.join(root, file)
23
+
18
24
  @classmethod
19
25
  def _get_key(cls, folder="", pkey=None):
20
26
  if folder and not folder.endswith("/"):
@@ -69,10 +75,10 @@ class ImageStorage:
69
75
  if not asset_id:
70
76
  return ""
71
77
  original_path = f"{self.get_path(asset_id)}"
72
- # log(f"Getting image: {asset_id}.{size}", original_path)
78
+ # log(f"Getting image: {asset_id}", original_path)
73
79
  if not os.path.exists(original_path):
74
80
  log(f"Original image not found: {original_path}")
75
- return ""
81
+ return None
76
82
  file_path = f"{original_path}/{size}.webp"
77
83
  # log(file_path)
78
84
  result_url = f"/{file_path}"
@@ -109,10 +115,7 @@ class ImageStorage:
109
115
 
110
116
  def get_path(self, asset_id):
111
117
  if asset_id:
112
- asset_path = asset_id.replace(".", "/")
113
- if asset_path.endswith("/"):
114
- asset_path = asset_path[:-1]
115
- return os.path.join(self.base_path, f"{asset_path}")
118
+ return os.path.join(self.base_path, f"{asset_id}")
116
119
  else:
117
120
  return self.base_path
118
121
 
@@ -129,9 +132,12 @@ class ImageStorage:
129
132
  return imgs
130
133
 
131
134
  def remove(self, asset_id):
135
+ if not asset_id:
136
+ return False
132
137
  file_path = self.get_path(asset_id)
133
138
  if os.path.isdir(file_path):
134
- os.rmdir(file_path)
139
+ print(f"Removing {file_path}")
140
+ # return shutil.rmtree(file_path, ignore_errors=True)
135
141
  return False
136
142
 
137
143
  def clear_cached(self, asset_id):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.2.22
3
+ Version: 0.2.23
4
4
  Summary: Containerized application framework built on Flask with additional libraries and tools for rapid development of web applications.
5
5
  Author-email: Steven A Moore <samoore@binghamton.edu>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- autonomous/__init__.py,sha256=9ulnRfkifMh508zMo0ZotnJ6X_YN3YLiqajC2MbKRF4,87
1
+ autonomous/__init__.py,sha256=ye9QZlO6j8ZNUNYXFl1tzzfFxNQpCCa3i527pQF1FrY,87
2
2
  autonomous/cli.py,sha256=z4AaGeWNW_uBLFAHng0J_lfS9v3fXemK1PeT85u4Eo4,42
3
3
  autonomous/logger.py,sha256=jePQ4kTtECTwGtIcDmpLSE6rSwhaUEiQe2vK06h5XIg,1915
4
4
  autonomous/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,7 +19,7 @@ autonomous/model/automodel.py,sha256=-YXzE6Pacxao3bu6_ItivRxryd-YLbd-F9_TRaStIwk
19
19
  autonomous/model/orm.py,sha256=IJrbp15RmBgF61vLsqcS_VdnAnw9736sLW75_xFYE9Y,2521
20
20
  autonomous/model/serializer.py,sha256=ixJ5LZ0sicv49WIaPKSzNX0IFy0InlHYv9X-uG8Pi5Y,3048
21
21
  autonomous/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- autonomous/storage/imagestorage.py,sha256=jR1abLTNcrS02OYXAomsMkL-MIQuWbPXjPxHOAc628M,6040
22
+ autonomous/storage/imagestorage.py,sha256=azV594Z_v-wf3W8lUtgLIb5q5O5VrAtqE2kxGtSIUKA,6250
23
23
  autonomous/storage/localstorage.py,sha256=FzrR6O9mMGAZt5dDgqzkeOQVfGRXCygR0kksz2MPpwE,2286
24
24
  autonomous/storage/markdown.py,sha256=tf8vlHARiQO1X_aGbqlYozzP_TbdiDRT9EEP6aFRQo0,2153
25
25
  autonomous/storage/version_control/GHCallbacks.py,sha256=AyiUlYfV5JePi11GVyqYyXoj5UTbPKzS-HRRI94rjJo,1069
@@ -29,8 +29,8 @@ autonomous/storage/version_control/GHVersionControl.py,sha256=VIhVRxe6gJgozFWyhy
29
29
  autonomous/storage/version_control/__init__.py,sha256=tP0bAWYl1RwBRi62HsIidmgyqHuSlCUqwGuKUKKRugc,117
30
30
  autonomous/tasks/__init__.py,sha256=pn7iZ14MhcHUdzcLkfkd4-45wgPP0tXahAz_cFgb_Tg,32
31
31
  autonomous/tasks/autotask.py,sha256=_WQ8w1LyV2FVJ0Ct0FoF9q1W8ClXfS57-omnBb0LNWE,4910
32
- autonomous_app-0.2.22.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
33
- autonomous_app-0.2.22.dist-info/METADATA,sha256=lMjolFoTDRAgacf8CERHgFgH95Nwpl0z2X42Gz3Nsz4,4229
34
- autonomous_app-0.2.22.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
35
- autonomous_app-0.2.22.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
36
- autonomous_app-0.2.22.dist-info/RECORD,,
32
+ autonomous_app-0.2.23.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
33
+ autonomous_app-0.2.23.dist-info/METADATA,sha256=d6iKy7LcXIZ_wNRczRNHY_aw2rE5zZBBQSDR6skBW0w,4229
34
+ autonomous_app-0.2.23.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
35
+ autonomous_app-0.2.23.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
36
+ autonomous_app-0.2.23.dist-info/RECORD,,