osbot-utils 1.24.0__py3-none-any.whl → 1.26.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.
@@ -4,6 +4,7 @@ from osbot_utils.decorators.lists.group_by import group_by
4
4
  from osbot_utils.decorators.lists.index_by import index_by
5
5
  from osbot_utils.utils.Dev import pprint
6
6
  from osbot_utils.utils.Env import get_env
7
+ from osbot_utils.utils.Http import is_port_open
7
8
  from osbot_utils.utils.Misc import str_to_int, str_to_bool
8
9
  from osbot_utils.utils.Process import start_process, run_process
9
10
  from osbot_utils.utils.Status import status_error
@@ -140,10 +141,11 @@ class SSH__Execute(Type_Safe):
140
141
  def ssh_not__setup_ok(self):
141
142
  return self.ssh_setup_ok() is False
142
143
 
143
- # print helpers
144
- # def print_ls(self, path=''):
145
- # pprint(self.ls(path))
146
- # return self
144
+ def ssh_host_available(self):
145
+ return is_port_open(self.ssh_host, self.ssh_port)
146
+
147
+ def ssh_host_not_available(self):
148
+ return self.ssh_host_available() is False
147
149
 
148
150
  def print_status__stderr__stdout(self, result):
149
151
  print()
@@ -21,6 +21,10 @@ class TestCase__SSH(TestCase):
21
21
  import pytest # we can only import this locally since this dependency doesn't exist in the main osbot_utils codebase
22
22
  pytest.skip("SSH host not set")
23
23
 
24
+ with cls.ssh.ssh_execute() as _:
25
+ if _.ssh_not__setup_ok() or _.ssh_host_not_available():
26
+ cls.skipTest(cls, 'ssh is not setup or enabled')
27
+
24
28
  cls.cache = SSH__Cache__Requests()
25
29
  cls.cache.patch_apply()
26
30
 
@@ -11,7 +11,7 @@ from osbot_utils.helpers.trace.Trace_Call__View_Model import Trace_Call__V
11
11
 
12
12
 
13
13
  def trace_calls(title = None , print_traces = True , show_locals = False, source_code = False ,
14
- ignore = None , include = None , show_path = False, duration_bigger_than = 0 ,
14
+ ignore = None , include = None , show_path = False, duration_bigger_than = 0 , trace_depth=0,
15
15
  max_string = None , show_types = False, show_duration = False ,# show_caller = False , # todo: add back when show_caller is working again
16
16
  show_class = False, contains = None , show_internals = False, enabled = True ,
17
17
  extra_data = False, show_lines = False, print_lines = False, show_types_padding = None , duration_padding=None):
@@ -30,7 +30,8 @@ def trace_calls(title = None , print_traces = True , show_locals = Fa
30
30
  capture_extra_data=extra_data,
31
31
  print_padding_parent_info= show_types_padding, print_padding_duration=duration_padding,
32
32
  print_lines_on_exit=print_lines, trace_enabled=enabled,
33
- trace_capture_lines=show_lines or print_lines)
33
+ trace_capture_lines=show_lines or print_lines,
34
+ trace_up_to_depth=trace_depth)
34
35
 
35
36
  config = (Trace_Call__Config().update_from_kwargs (**config_kwargs))
36
37
 
@@ -168,7 +168,7 @@ class Trace_Call__Handler(Kwargs_To_Self):
168
168
  capture = False
169
169
 
170
170
  for item in self.config.trace_ignore_start_with: # Check if the module should be ignored
171
- if module.startswith(item):
171
+ if module.startswith(item) or func_name.startswith(item):
172
172
  capture = False
173
173
  break
174
174
  return capture
osbot_utils/utils/Env.py CHANGED
@@ -94,6 +94,9 @@ def load_dotenv(dotenv_path=None, override=False): # todo: add dete
94
94
  def not_in_github_action():
95
95
  return in_github_action() is False
96
96
 
97
+ def set_env(key, value):
98
+ os.environ[key] = value
99
+ return value
97
100
 
98
101
  def unload_dotenv(dotenv_path=None):
99
102
  if dotenv_path: # If a specific dotenv path is provided, unload from it
@@ -99,7 +99,8 @@ class Python_Logger(Type_Safe):
99
99
  def setup(self, logger_name=None, log_level=None,add_console_logger=False, add_memory_logger=True):
100
100
  if logger_name:
101
101
  self.logger_name = logger_name
102
- self.logger = logging.getLogger(self.logger_name)
102
+ if self.logger is None:
103
+ self.logger = logging.getLogger(self.logger_name)
103
104
  self.setup_log_methods()
104
105
  self.set_log_level(log_level)
105
106
  if add_console_logger:
osbot_utils/version CHANGED
@@ -1 +1 @@
1
- v1.24.0
1
+ v1.26.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osbot_utils
3
- Version: 1.24.0
3
+ Version: 1.26.0
4
4
  Summary: OWASP Security Bot - Utils
5
5
  Home-page: https://github.com/owasp-sbot/OSBot-Utils
6
6
  License: MIT
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  Powerful Python util methods and classes that simplify common apis and tasks.
24
24
 
25
- ![Current Release](https://img.shields.io/badge/release-v1.24.0-blue)
25
+ ![Current Release](https://img.shields.io/badge/release-v1.26.0-blue)
26
26
  [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
27
27
 
28
28
 
@@ -219,17 +219,17 @@ osbot_utils/helpers/sqlite/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
219
219
  osbot_utils/helpers/ssh/SCP.py,sha256=9PgJbyWKfxJj00Ijaj7o6ffxPXuNoureb6JlHMPbHww,3330
220
220
  osbot_utils/helpers/ssh/SSH.py,sha256=jyRZIL8rif1Fn76i0ZJWSkY0VyQuB1J2LAWIvu4jKpU,1545
221
221
  osbot_utils/helpers/ssh/SSH__Cache__Requests.py,sha256=Dqh4biVcuaXbQVvn3Tx-kSGBGHiF-2wVsgu96EhD6gU,3359
222
- osbot_utils/helpers/ssh/SSH__Execute.py,sha256=D5tQGbSPaNsrMvhTVT0sZIHpqF1rIYXYiaWzGExcwm4,6849
222
+ osbot_utils/helpers/ssh/SSH__Execute.py,sha256=YSZEsS_j2PWyfGQNYNv2lvvo2tZlT3pGIwx0YLRqZ4w,6969
223
223
  osbot_utils/helpers/ssh/SSH__Health_Check.py,sha256=WDmBD6ejNcBeicXfjpsiNzH-WR3Jejx0re3WfwjSWyQ,2083
224
224
  osbot_utils/helpers/ssh/SSH__Linux.py,sha256=O1uyKcklaj2tHqQZln7dVinzjl9-EI52KzP8ojQr244,4330
225
225
  osbot_utils/helpers/ssh/SSH__Linux__Amazon.py,sha256=ZJFb7LFTvclAuhH5OoOtJ361NoX9ecHTaFX-iSmnzmk,596
226
226
  osbot_utils/helpers/ssh/SSH__Python.py,sha256=O2DAwkbXzwkis8lffoqIL2NPSfYcN44Mr8i9Ey2iMKk,2066
227
- osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=rlhkiVr1OR_3uiwqK2dVZ-yBwZZpUhMq6BPT2p21H1s,1598
227
+ osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=MD8sq0_kI4f6pEmEO0cLq2mQOhIqbP45ZxFJNG44Jg4,1773
228
228
  osbot_utils/helpers/ssh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
- osbot_utils/helpers/trace/Trace_Call.py,sha256=xTmR5U2u0vKnIgMSu-4NAibWKIV4-Eql3vACwOr1lkw,6329
229
+ osbot_utils/helpers/trace/Trace_Call.py,sha256=WXw1QyHxVrkKk24NlMbrsLQdbQTgN2ocwEFqkfB6n2E,6408
230
230
  osbot_utils/helpers/trace/Trace_Call__Config.py,sha256=6nJplzrY1adz3WcwTIuwEhBCk1P0U0NbyWRzDyIox_Q,3250
231
231
  osbot_utils/helpers/trace/Trace_Call__Graph.py,sha256=HCrXRKQI42DIQxxyFLcaosWiOcUyoITbeV17ICdXcXM,1156
232
- osbot_utils/helpers/trace/Trace_Call__Handler.py,sha256=Ay5YEmwr8ZCK7YfFWCkOTys5zmiM3qrS0ebwGFx9-hc,11533
232
+ osbot_utils/helpers/trace/Trace_Call__Handler.py,sha256=3gEX-DykEFixfBmD0jBdMhnTujxhNbXkjOhqxNTc9ac,11563
233
233
  osbot_utils/helpers/trace/Trace_Call__Print_Lines.py,sha256=cy7zLv0_JNxdOIQPfZk6J9bv6AkIW6O643w0ykClXbw,4820
234
234
  osbot_utils/helpers/trace/Trace_Call__Print_Traces.py,sha256=2LGeWMGP1uhSojGMmJmL3bH2B5LFIlfYEqEPNqoyKJw,8628
235
235
  osbot_utils/helpers/trace/Trace_Call__Stack.py,sha256=pIvZ2yP4tymOQraUR2N5R-qlmg5QijyLxt85zmMajUs,7462
@@ -263,7 +263,7 @@ osbot_utils/utils/Assert.py,sha256=u9XLgYn91QvNWZGyPi29SjPJSXRHlm9andIn3NJEVog,1
263
263
  osbot_utils/utils/Call_Stack.py,sha256=MAq_0vMxnbeLfCe9qQz7GwJYaOuXpt3qtQwN6wiXsU0,6595
264
264
  osbot_utils/utils/Csv.py,sha256=oHLVpjRJqrLMz9lubMCNEoThXWju5rNTprcwHc1zq2c,1012
265
265
  osbot_utils/utils/Dev.py,sha256=HibpQutYy_iG8gGV8g1GztxNN4l29E4Bi7UZaVL6-L8,1203
266
- osbot_utils/utils/Env.py,sha256=CrvDcpY9NEuvyvG_QHcv1oSfw8BKXN6MqVEbPF_OqFU,5008
266
+ osbot_utils/utils/Env.py,sha256=uYLhqVXqqgfh03Zmf9Vdy9zFdFf0rasW6lteh_VM1xQ,5078
267
267
  osbot_utils/utils/Exceptions.py,sha256=KyOUHkXQ_6jDTq04Xm261dbEZuRidtsM4dgzNwSG8-8,389
268
268
  osbot_utils/utils/Files.py,sha256=q4_JeNWZygM8T0_frpTGvZjtISC1ZyJTOr3bD9pCKUE,19599
269
269
  osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
@@ -276,15 +276,15 @@ osbot_utils/utils/Misc.py,sha256=ljscBemI5wOhfkl1BVpsqshacTOCKkOisV4er9xPCWM,166
276
276
  osbot_utils/utils/Objects.py,sha256=WFH3oeXR1CU03oyzXfcIlktcoXQuKw9cIJn8xTs02AE,14654
277
277
  osbot_utils/utils/Png.py,sha256=V1juGp6wkpPigMJ8HcxrPDIP4bSwu51oNkLI8YqP76Y,1172
278
278
  osbot_utils/utils/Process.py,sha256=lr3CTiEkN3EiBx3ZmzYmTKlQoPdkgZBRjPulMxG-zdo,2357
279
- osbot_utils/utils/Python_Logger.py,sha256=7IPB6gMw-G9HWdgyG_k6d7CE71P55-SAudKgDVxraMs,12756
279
+ osbot_utils/utils/Python_Logger.py,sha256=tx8N6wRKL3RDHboDRKZn8SirSJdSAE9cACyJkxrThZ8,12792
280
280
  osbot_utils/utils/Status.py,sha256=Yq4s0TelXgn0i2QjCP9V8mP30GabXp_UL-jjM6Iwiw4,4305
281
281
  osbot_utils/utils/Str.py,sha256=kxdY8ROX4FdJtCaMTfOc8fK_xcDICprNkefHu2MMNU4,2585
282
282
  osbot_utils/utils/Toml.py,sha256=dqiegndCJF7V1YT1Tc-b0-Bl6QWyL5q30urmQwMXfMQ,1402
283
283
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
284
284
  osbot_utils/utils/Zip.py,sha256=YFahdBguVK71mLdYy4m7mqVAQ5al-60QnTmYK-txCfY,6784
285
285
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
286
- osbot_utils/version,sha256=ZD3YCx9CcqVfYvN3EZrH5YNt6_M4up_qb295gQk6gwg,8
287
- osbot_utils-1.24.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
288
- osbot_utils-1.24.0.dist-info/METADATA,sha256=E-QECitRSsPhAR9aTUqtH7_7eM2y2PIG3ezGzStkr2Q,1266
289
- osbot_utils-1.24.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
290
- osbot_utils-1.24.0.dist-info/RECORD,,
286
+ osbot_utils/version,sha256=U6XfqJy3uErITQwIljLFrmcd6bNbxgAaOZBn2N10FzA,8
287
+ osbot_utils-1.26.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
288
+ osbot_utils-1.26.0.dist-info/METADATA,sha256=v-yB6jau74HW-32x-u-GKJrage3pT0FS-URSEdPR0_U,1266
289
+ osbot_utils-1.26.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
290
+ osbot_utils-1.26.0.dist-info/RECORD,,