autonomous-app 0.2.21__py3-none-any.whl → 0.2.22__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.21"
1
+ __version__ = "0.2.22"
2
2
 
3
3
  from .logger import log
4
4
  from .model.automodel import AutoModel
@@ -1,3 +1,4 @@
1
+ import glob
1
2
  import io
2
3
  import os
3
4
  import shutil
@@ -130,6 +131,40 @@ class ImageStorage:
130
131
  def remove(self, asset_id):
131
132
  file_path = self.get_path(asset_id)
132
133
  if os.path.isdir(file_path):
133
- shutil.rmtree(file_path)
134
- return True
134
+ os.rmdir(file_path)
135
+ return False
136
+
137
+ def clear_cached(self, asset_id):
138
+ file_path = self.get_path(asset_id)
139
+ if os.path.isdir(file_path):
140
+ for file in glob.glob(os.path.join(file_path, "*")):
141
+ if os.path.basename(file) != "orig.webp":
142
+ os.remove(file)
143
+ return False
144
+
145
+ def rotate(self, asset_id, amount=-90):
146
+ file_path = self.get_path(asset_id)
147
+ log(asset_id)
148
+ with Image.open(f"{file_path}/orig.webp") as img:
149
+ # Rotate the image 90 degrees
150
+ rotated_img = img.rotate(amount, expand=True)
151
+ # Save the rotated image
152
+ log(img, rotated_img)
153
+ # img = img.copy()
154
+ # img_byte_arr = io.BytesIO()
155
+ # img.save(img_byte_arr, )
156
+ self.clear_cached(asset_id)
157
+ rotated_img.save(f"{file_path}/orig.webp", format="WEBP")
158
+ return False
159
+
160
+ def flip(self, asset_id, flipx=True, flipy=True):
161
+ file_path = self.get_path(asset_id)
162
+ with Image.open(f"{file_path}/orig.webp") as img:
163
+ if flipx:
164
+ rotated_img = img.transpose(Image.FLIP_LEFT_RIGHT)
165
+ if flipy:
166
+ rotated_img = img.transpose(Image.FLIP_TOP_BOTTOM)
167
+ # Save the rotated image
168
+ rotated_img.save(f"{file_path}/orig.webp", format="WEBP")
169
+ self.clear_cached(asset_id)
135
170
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.2.21
3
+ Version: 0.2.22
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=LLciXStkOmC-MKc4bzVRr5CPdgPu0631mN7x2v30Z08,87
1
+ autonomous/__init__.py,sha256=9ulnRfkifMh508zMo0ZotnJ6X_YN3YLiqajC2MbKRF4,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=RlZ6F4s7FGpcyzJq8IstN-CDhhSigEQjJL5L7OVCxUM,4671
22
+ autonomous/storage/imagestorage.py,sha256=jR1abLTNcrS02OYXAomsMkL-MIQuWbPXjPxHOAc628M,6040
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.21.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
33
- autonomous_app-0.2.21.dist-info/METADATA,sha256=B6VcONmSN89dxeNtTnHxgNS-BgFHIjQ4W5GnvEbuhho,4229
34
- autonomous_app-0.2.21.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
35
- autonomous_app-0.2.21.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
36
- autonomous_app-0.2.21.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5