osbot-utils 1.91.0__py3-none-any.whl → 1.92.0__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.
@@ -64,6 +64,24 @@ class Type_Safe:
64
64
  def __enter__(self): return self
65
65
  def __exit__(self, exc_type, exc_val, exc_tb): pass
66
66
 
67
+ def __getattr__(self, name): # Called when an attribute is not found through normal attribute access
68
+ if name.startswith(("set_", "get_")): # Check if the requested attribute is a getter or setter method
69
+ prefix = name[:4] # Extract "set_" or "get_" from the method name
70
+ attr_name = name[4:] # Get the actual attribute name by removing the prefix
71
+
72
+ if hasattr(self, attr_name): # Verify that the target attribute actually exists on the object
73
+ if prefix == "set_": # Handle setter method creation
74
+ def setter(value): # Create a dynamic setter function that takes a value parameter
75
+ setattr(self, attr_name, value) # Set the attribute value using type-safe setattr from Type_Safe
76
+ return self # Return self for method chaining
77
+ return setter # Return the setter function
78
+ else: # get_ # Handle getter method creation
79
+ def getter(): # Create a dynamic getter function with no parameters
80
+ return getattr(self, attr_name) # Return the attribute value using Python's built-in getattr
81
+ return getter # Return the getter function
82
+
83
+ raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") # Raise error if attribute is not a valid getter/setter
84
+
67
85
  def __setattr__(self, name, value):
68
86
  from osbot_utils.utils.Objects import convert_dict_to_value_from_obj_annotation
69
87
  from osbot_utils.utils.Objects import convert_to_value_from_obj_annotation
@@ -1,8 +1,5 @@
1
- from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
2
- from osbot_utils.graphs.mermaid.Mermaid__Node import LINE_PADDING, Mermaid__Node
1
+ from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
3
2
  from osbot_utils.graphs.mgraph.MGraph__Node import MGraph__Node
4
- from osbot_utils.utils.Str import safe_str
5
-
6
3
 
7
4
  class MGraph__Edge(Kwargs_To_Self):
8
5
  attributes : dict
@@ -1,6 +1,5 @@
1
- from osbot_utils.utils.Misc import random_id
2
-
3
- from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
1
+ from osbot_utils.utils.Misc import random_id
2
+ from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
4
3
 
5
4
 
6
5
  class MGraph__Node(Kwargs_To_Self):
@@ -1,9 +1,8 @@
1
- from enum import Enum, auto
2
- from osbot_utils.utils.Str import safe_str
3
- from osbot_utils.helpers.Local_Cache import Local_Cache
4
-
1
+ from enum import Enum, auto
2
+ from osbot_utils.utils.Str import safe_str
3
+ from osbot_utils.helpers.Local_Cache import Local_Cache
5
4
  from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
6
- from osbot_utils.graphs.mgraph.MGraph import MGraph
5
+ from osbot_utils.graphs.mgraph.MGraph import MGraph
7
6
 
8
7
 
9
8
  class Serialization_Mode(Enum):
@@ -1,10 +1,5 @@
1
- import random
2
-
3
- from osbot_utils.utils.Files import file_exists, file_extension, pickle_load_from_file
4
-
5
1
  from osbot_utils.graphs.mgraph.MGraph__Random_Graphs import MGraph__Random_Graphs
6
2
 
7
-
8
3
  class MGraphs:
9
4
 
10
5
  def new__random(self, config=None, graph_key=None, x_nodes=10, y_edges=20):
@@ -25,13 +25,14 @@ class RSS__Feed__Parser:
25
25
  guid = self.extract_guid(item_data.get('guid' ))
26
26
  pubDate = self.element_text(item_data.get('pubDate' ))
27
27
  creator = self.element_text(item_data.get('creator' ))
28
+ categories = self.ensure_is_list(item_data.get('category'))
28
29
  rss_item = RSS__Item(title = title ,
29
30
  link = link ,
30
31
  description = description ,
31
32
  guid = guid ,
32
33
  pubDate = pubDate ,
33
34
  creator = creator ,
34
- categories = item_data.get('category' , []),
35
+ categories = categories ,
35
36
  content = item_data.get('content' , {}),
36
37
  thumbnail = item_data.get('thumbnail' , {}))
37
38
 
@@ -74,6 +75,15 @@ class RSS__Feed__Parser:
74
75
  def extract_guid(self, target):
75
76
  return Guid(self.extract_text(target))
76
77
 
78
+ def ensure_is_list(self, target):
79
+ if type(target) is list:
80
+ return target
81
+ if type(target) is str:
82
+ return [target]
83
+ if target:
84
+ return [f'{target}']
85
+ return []
86
+
77
87
  def element_text(self, target):
78
88
  if isinstance(target, list):
79
89
  for item in target:
osbot_utils/version CHANGED
@@ -1 +1 @@
1
- v1.91.0
1
+ v1.92.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osbot_utils
3
- Version: 1.91.0
3
+ Version: 1.92.0
4
4
  Summary: OWASP Security Bot - Utils
5
5
  Home-page: https://github.com/owasp-sbot/OSBot-Utils
6
6
  License: MIT
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
23
23
 
24
24
  Powerful Python util methods and classes that simplify common apis and tasks.
25
25
 
26
- ![Current Release](https://img.shields.io/badge/release-v1.91.0-blue)
26
+ ![Current Release](https://img.shields.io/badge/release-v1.92.0-blue)
27
27
  [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
28
28
 
29
29
 
@@ -2,7 +2,7 @@ osbot_utils/__init__.py,sha256=DdJDmQc9zbQUlPVyTJOww6Ixrn9n4bD3ami5ItQfzJI,16
2
2
  osbot_utils/base_classes/Cache_Pickle.py,sha256=kPCwrgUbf_dEdxUz7vW1GuvIPwlNXxuRhb-H3AbSpII,5884
3
3
  osbot_utils/base_classes/Kwargs_To_Disk.py,sha256=HHoy05NC_w35WcT-OnSKoSIV_cLqaU9rdjH0_KNTM0E,1096
4
4
  osbot_utils/base_classes/Kwargs_To_Self.py,sha256=weFNsBfBNV9W_qBkN-IdBD4yYcJV_zgTxBRO-ZlcPS4,141
5
- osbot_utils/base_classes/Type_Safe.py,sha256=JT_lzMkdt7zmLFAPProbgk30J3iBjLgpavGOZ7XwvXY,25611
5
+ osbot_utils/base_classes/Type_Safe.py,sha256=D1SzaB3Km-UrlucCE3boL5_dbTQBDn1-s1URbehRl8w,27754
6
6
  osbot_utils/base_classes/Type_Safe__Base.py,sha256=CFPYe8_i5vvTLyc7s8CXbY4n_dY6sqVfBY8w9Vo77ZA,5468
7
7
  osbot_utils/base_classes/Type_Safe__Dict.py,sha256=sfZcukhXUd9TS0PQpAk-gGLfZUJSC6BtMh6jF4Fn8Jw,1107
8
8
  osbot_utils/base_classes/Type_Safe__List.py,sha256=pXDzJJttpEQQ9oTdsw7BykMB4VIX2rZzi1ZrnCzMZ8M,650
@@ -53,11 +53,11 @@ osbot_utils/graphs/mermaid/models/Mermaid__Node__Shape.py,sha256=_su5S8nYqg5qpXm
53
53
  osbot_utils/graphs/mgraph/MGraph.py,sha256=1Iu2CM9IHxoJxjmABsBqDvi8l09LINLDE9_b53Dz4kM,2218
54
54
  osbot_utils/graphs/mgraph/MGraph__Config.py,sha256=oFTj9eP92HolaOSyk-7tpsPVFZLMIcTH-O-mx93nTiA,204
55
55
  osbot_utils/graphs/mgraph/MGraph__Data.py,sha256=oLaKmxUOXoQbhdUxa_VW_QZA0tAETgRMzP3pvslppHw,5746
56
- osbot_utils/graphs/mgraph/MGraph__Edge.py,sha256=TnYUk6-YFpB3_6zY-CY6jJFVSLciGbCxE-fuABw9LX4,916
57
- osbot_utils/graphs/mgraph/MGraph__Node.py,sha256=WPdAzd74sbWm4nD4ELH23g52I5mNHu5KjHDOk38qMIY,876
56
+ osbot_utils/graphs/mgraph/MGraph__Edge.py,sha256=sS9LojdWZ8AISD0d8gdY6HgcyPM956roHmEkzhM_TQg,785
57
+ osbot_utils/graphs/mgraph/MGraph__Node.py,sha256=KnUnD918hu5ifjbW_v7AVAAzxjHi5iuA4rluvDGOaPg,893
58
58
  osbot_utils/graphs/mgraph/MGraph__Random_Graphs.py,sha256=MDCmnrv7QcGXJeZDYc4y5Wth6ysB0hHzn1DqfocxtIs,964
59
- osbot_utils/graphs/mgraph/MGraph__Serializer.py,sha256=F8epC-55qMyBZiMD5SLPVmLgIKj2iosiblb7heTH_cQ,1408
60
- osbot_utils/graphs/mgraph/MGraphs.py,sha256=W8GlTBQ-1nBb9Zj3nbZ3QetyaP1LlkhMBVOiOLIsCE4,636
59
+ osbot_utils/graphs/mgraph/MGraph__Serializer.py,sha256=pLgKsJuo1x8S22m6TCLd3bvFLrBo6sTrq1AkknkOA18,1475
60
+ osbot_utils/graphs/mgraph/MGraphs.py,sha256=TIv1CEsUiPIVxll3AuGLhEVBY4YRzZu_rpEz3Tzrph8,532
61
61
  osbot_utils/graphs/mgraph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  osbot_utils/helpers/CFormat.py,sha256=1_XvqGwgU6qC97MbzcKF0o7s9mCXpU5Kq9Yf-1ixUwY,6808
63
63
  osbot_utils/helpers/CPrint.py,sha256=ztKPNmT8BGxeyPXSQKRs63PqqbgxKDz_BiZmzFMup9g,1413
@@ -288,7 +288,7 @@ osbot_utils/helpers/xml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
288
288
  osbot_utils/helpers/xml/rss/RSS__Channel.py,sha256=HPLsGRNIaPh0_8GYE2a53bSV5Bb4E6j6tKGuy4bxg4Y,605
289
289
  osbot_utils/helpers/xml/rss/RSS__Enclosure.py,sha256=f75U7nXXJ7hLs2zPDui0WsFAmMJaeaverjlxD4M-Otg,142
290
290
  osbot_utils/helpers/xml/rss/RSS__Feed.py,sha256=lhFoeBMWdH1Dp8QnagCGj9bfZHKmB_HkE56hPVZNaM0,425
291
- osbot_utils/helpers/xml/rss/RSS__Feed__Parser.py,sha256=qG4FbUexMmU6_pTgcxDBmBeZvh9d1dmFZGzQOwVlggk,5088
291
+ osbot_utils/helpers/xml/rss/RSS__Feed__Parser.py,sha256=7sub6zcWqGz8FORXFYRyopTswboUkCU5uGEXAZ6BZDw,5380
292
292
  osbot_utils/helpers/xml/rss/RSS__Image.py,sha256=4uI0jd17pqb8FJ8HQcERXvn3WjGbiOVI8u1tv-IN59U,171
293
293
  osbot_utils/helpers/xml/rss/RSS__Item.py,sha256=y-QI2WBfd9FEsVWc_eNirvZUUslpb2z27hxcm-RVHJQ,611
294
294
  osbot_utils/testing/Catch.py,sha256=HdNoKnrPBjvVj87XYN-Wa1zpo5z3oByURT6TKbd5QpQ,2229
@@ -339,8 +339,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
339
339
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
340
340
  osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
341
341
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
342
- osbot_utils/version,sha256=mY1aZ-j7A_cOD1nfZEVe-d0NfwVf728QcJbLk0BIvkI,8
343
- osbot_utils-1.91.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
344
- osbot_utils-1.91.0.dist-info/METADATA,sha256=luU4ieNWlaNSKRUyf9jTUyGb2tKGwRPlZtgZ5cZCTPc,1317
345
- osbot_utils-1.91.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
346
- osbot_utils-1.91.0.dist-info/RECORD,,
342
+ osbot_utils/version,sha256=HcQJfW9qetpTTCAJA7zp8wAdYNIGH7zJcl-GVVPylC4,8
343
+ osbot_utils-1.92.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
344
+ osbot_utils-1.92.0.dist-info/METADATA,sha256=BD8zNKY7lu6bJuUASVxE_R_j2ywMvZj6t32oFGOn9Sw,1317
345
+ osbot_utils-1.92.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
346
+ osbot_utils-1.92.0.dist-info/RECORD,,