autonomous-app 0.2.18__py3-none-any.whl → 0.2.19__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.18"
1
+ __version__ = "0.2.19"
2
2
 
3
3
  from .logger import log
4
4
  from .model.automodel import AutoModel
autonomous/logger.py CHANGED
@@ -28,6 +28,8 @@ class Logger:
28
28
  level = os.environ.get("LOG_LEVEL") or self.logger.level
29
29
  self.logger.setLevel(log_levels.get(level, "DEBUG"))
30
30
  self.enabled = True
31
+ if not os.path.exists("logs"):
32
+ os.makedirs("logs")
31
33
  self.logfile = "logs/current_run_error_log.log"
32
34
  self.logarchive = (
33
35
  f"logs/error_log-{datetime.datetime.now().strftime('%Y-%m-%d')}.log"
@@ -2,7 +2,6 @@
2
2
  # default : Optional[str] = "value" # for default values
3
3
  import copy
4
4
  import importlib
5
- import json
6
5
  from abc import ABC
7
6
  from datetime import datetime
8
7
 
@@ -119,12 +118,18 @@ class AutoModel(ABC):
119
118
  v = v.default
120
119
  setattr(obj, k, result.get(k, copy.deepcopy(v)))
121
120
  obj.pk = pk
121
+ for key, val in list(kwargs.items()):
122
+ if (
123
+ getattr(cls, key, None)
124
+ and getattr(cls, key).fset
125
+ and f"_{key}" in cls.attributes
126
+ ):
127
+ kwargs[f"_{key}"] = kwargs.pop(key)
122
128
  obj.__dict__ |= kwargs
123
129
  # breakpoint()
124
130
  obj.__dict__ = AutoDecoder.decode(obj.__dict__)
125
131
  obj._automodel = obj.model_name(qualified=True)
126
132
  obj.last_updated = datetime.now()
127
-
128
133
  return obj
129
134
 
130
135
  def __getattribute__(self, name):
@@ -249,20 +254,24 @@ class AutoModel(ABC):
249
254
  val = getattr(self, key)
250
255
  if vattr.type == "TEXT":
251
256
  if not isinstance(val, str):
252
- raise TypeError(f"Value must be a string, not {type(val)}")
257
+ raise TypeError(
258
+ f"{key} value must be a string, not {type(val)}"
259
+ )
253
260
  elif vattr.type == "NUMERIC":
254
261
  if not isinstance(val, (int, float)):
255
- raise TypeError(f"Value must be a number, not {type(val)}")
262
+ raise TypeError(
263
+ f"{key} value must be a number, not {type(val)}"
264
+ )
256
265
  elif vattr.type == "MODEL":
257
266
  # log(isinstance(val, (AutoModel, DelayedModel)), type(val))
258
267
  if val is not None and not isinstance(
259
268
  val, (AutoModel, DelayedModel)
260
269
  ):
261
270
  raise TypeError(
262
- f"Value must be an AutoModel or None, not {type(val)}"
271
+ f"{key} value must be an AutoModel or None, not {type(val)}"
263
272
  )
264
273
  else:
265
- raise ValueError(f"Invalid type {self.type}")
274
+ raise ValueError(f"{key}: Invalid type {self.type}")
266
275
 
267
276
  if vattr.required and val is None:
268
277
  raise ValueError(f"{key} is required")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.2.18
3
+ Version: 0.2.19
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,6 +1,6 @@
1
- autonomous/__init__.py,sha256=k6591xprvdGn8dyTo1ckGzxECbwYVk2QFo68FshoZBA,87
1
+ autonomous/__init__.py,sha256=oDsDNe2n6SEIsx41D8osz_TCWX7CFSxlVvmZIb4PzM4,87
2
2
  autonomous/cli.py,sha256=z4AaGeWNW_uBLFAHng0J_lfS9v3fXemK1PeT85u4Eo4,42
3
- autonomous/logger.py,sha256=hDX3gvbcWiGPvA8pfarih3xHS4aHG_NuNkF8PQfq_pM,1844
3
+ autonomous/logger.py,sha256=jePQ4kTtECTwGtIcDmpLSE6rSwhaUEiQe2vK06h5XIg,1915
4
4
  autonomous/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  autonomous/ai/oaiagent.py,sha256=jOfAK6FIJN2n8CKrcrAcL8t1Jh5bgxk4bnBt0NwTXBE,7197
6
6
  autonomous/auth/__init__.py,sha256=IW5tQ8VYwHIbDfMYA0wYgx4PprwcjUWV4EoIJ8HTlMU,161
@@ -15,7 +15,7 @@ autonomous/errors/__init__.py,sha256=OruWG9IkAF4LN-OAo5c2K9Dnds4oZFJJQHKaXbQaWnA
15
15
  autonomous/errors/danglingreferenceerror.py,sha256=obfNjpn2vsyK4ak-UuuwFTMVzecs1SaeFPshOvnukS8,275
16
16
  autonomous/model/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
17
  autonomous/model/autoattribute.py,sha256=q09cORKC6-LpoZ3Ez-lRkd5kxuSFQrB2nA2f9_8k2c8,588
18
- autonomous/model/automodel.py,sha256=Z8iDZB7frSV_lQ09HL-l0ff0_ePEuPwjLzWnpbdCsJw,12391
18
+ autonomous/model/automodel.py,sha256=b3ivBawR1X4adLuL14vXYVRBwHYFsLG9B4pP-yURN3k,12772
19
19
  autonomous/model/orm.py,sha256=IJrbp15RmBgF61vLsqcS_VdnAnw9736sLW75_xFYE9Y,2521
20
20
  autonomous/model/serializer.py,sha256=0nfmw4-QNP-ozL4IVbgQyfPRF2i0-uG9pQZwgEPYuxU,3026
21
21
  autonomous/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.18.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
33
- autonomous_app-0.2.18.dist-info/METADATA,sha256=wJg_NtpIqVNuLuIJyb7ymhUxNIYtbO0DGF7afA3Dyts,4229
34
- autonomous_app-0.2.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
35
- autonomous_app-0.2.18.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
36
- autonomous_app-0.2.18.dist-info/RECORD,,
32
+ autonomous_app-0.2.19.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
33
+ autonomous_app-0.2.19.dist-info/METADATA,sha256=jVxFgZdhBn-NaDeY2X-59QSJyoazF4q8WXCadiYLpxs,4229
34
+ autonomous_app-0.2.19.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
35
+ autonomous_app-0.2.19.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
36
+ autonomous_app-0.2.19.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5