osbot-utils 1.37.0__py3-none-any.whl → 1.38.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.
- osbot_utils/helpers/Random_Guid.py +14 -0
- osbot_utils/utils/Files.py +16 -0
- osbot_utils/utils/Lists.py +3 -0
- osbot_utils/utils/Misc.py +8 -0
- osbot_utils/version +1 -1
- {osbot_utils-1.37.0.dist-info → osbot_utils-1.38.0.dist-info}/METADATA +2 -2
- {osbot_utils-1.37.0.dist-info → osbot_utils-1.38.0.dist-info}/RECORD +9 -8
- {osbot_utils-1.37.0.dist-info → osbot_utils-1.38.0.dist-info}/LICENSE +0 -0
- {osbot_utils-1.37.0.dist-info → osbot_utils-1.38.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# todo add to osbot utils
|
2
|
+
from osbot_utils.utils.Misc import random_guid
|
3
|
+
|
4
|
+
class Random_Guid(str):
|
5
|
+
def __new__(cls, value=None):
|
6
|
+
if value is None:
|
7
|
+
value = random_guid()
|
8
|
+
return str.__new__(cls, value)
|
9
|
+
|
10
|
+
def __init__(self, value=None):
|
11
|
+
self.value = value if value is not None else random_guid()
|
12
|
+
|
13
|
+
def __str__(self):
|
14
|
+
return self
|
osbot_utils/utils/Files.py
CHANGED
@@ -489,6 +489,22 @@ def file_move_to_folder(source_file, target_folder):
|
|
489
489
|
if file_move(source_file, target_file):
|
490
490
|
return target_file
|
491
491
|
|
492
|
+
def files_names_without_extension(files):
|
493
|
+
return [file_name_without_extension(file) for file in files]
|
494
|
+
|
495
|
+
def files_names_in_folder(target, with_extension=False):
|
496
|
+
if with_extension:
|
497
|
+
return files_names(files_in_folder(target))
|
498
|
+
else:
|
499
|
+
return files_names_without_extension(files_in_folder(target))
|
500
|
+
|
501
|
+
def files_in_folder(path,pattern='*', only_files=True):
|
502
|
+
result = []
|
503
|
+
for file in Path(path).glob(pattern):
|
504
|
+
if only_files and is_not_file(file):
|
505
|
+
continue
|
506
|
+
result.append(str(file)) # todo: see if there is a better way to do this conversion to string
|
507
|
+
return sorted(result)
|
492
508
|
|
493
509
|
def folders_names_in_folder(target):
|
494
510
|
folders = folders_in_folder(target)
|
osbot_utils/utils/Lists.py
CHANGED
@@ -93,6 +93,9 @@ def list_index_by(values, index_by):
|
|
93
93
|
def list_lower(input_list):
|
94
94
|
return [item.lower() for item in input_list]
|
95
95
|
|
96
|
+
def list_minus_list(list_a, list_b):
|
97
|
+
return [item for item in list_a if item not in list_b]
|
98
|
+
|
96
99
|
def list_not_empty(list):
|
97
100
|
if list and type(list).__name__ == 'list' and len(list) >0:
|
98
101
|
return True
|
osbot_utils/utils/Misc.py
CHANGED
@@ -8,6 +8,7 @@ import string
|
|
8
8
|
import sys
|
9
9
|
import textwrap
|
10
10
|
import re
|
11
|
+
import threading
|
11
12
|
import uuid
|
12
13
|
import warnings
|
13
14
|
from datetime import datetime, timedelta
|
@@ -67,6 +68,10 @@ def convert_to_number(value):
|
|
67
68
|
else:
|
68
69
|
return 0
|
69
70
|
|
71
|
+
def current_thread_id():
|
72
|
+
return threading.current_thread().native_id
|
73
|
+
|
74
|
+
|
70
75
|
def date_time_from_to_str(date_time_str, format_from, format_to, print_conversion_error=False):
|
71
76
|
try:
|
72
77
|
date_time = datetime.strptime(date_time_str, format_from)
|
@@ -119,6 +124,9 @@ def date_time_now_less_time_delta(days=0,hours=0, minutes=0, seconds=0, date_tim
|
|
119
124
|
def date_to_str(date, date_format='%Y-%m-%d'):
|
120
125
|
return date.strftime(date_format)
|
121
126
|
|
127
|
+
def date_today():
|
128
|
+
return date_time_now(date_time_format='%Y-%m-%d')
|
129
|
+
|
122
130
|
#note: this is here at the moment due to a circular dependency with lists and objects
|
123
131
|
def list_set(target: object) -> object:
|
124
132
|
if hasattr(target, '__iter__'):
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v1.
|
1
|
+
v1.38.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.38.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
|
-

|
26
26
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
27
27
|
|
28
28
|
|
@@ -62,6 +62,7 @@ osbot_utils/helpers/Local_Cache.py,sha256=0JZZX3fFImcwtbBvxAQl-EbBegSNJRhRMYF6ov
|
|
62
62
|
osbot_utils/helpers/Local_Caches.py,sha256=aQmi1HSM0TH6WQPedG2fbz4KCCJ3DQTU9d18rB1jR0M,1885
|
63
63
|
osbot_utils/helpers/Print_Table.py,sha256=LEXbyqGg_6WSraI4cob4bNNSu18ddqvALp1zGK7bPhs,19126
|
64
64
|
osbot_utils/helpers/Python_Audit.py,sha256=shpZlluJwqJBAlad6xN01FkgC1TsQ48RLvR5ZjmrKa4,1539
|
65
|
+
osbot_utils/helpers/Random_Guid.py,sha256=_wlyM17SIr-FeYESwnVt4cfkEtRRf-dbYh_lTnrKVG0,379
|
65
66
|
osbot_utils/helpers/Random_Seed.py,sha256=14btja8LDN9cMGWaz4fCNcMRU_eyx49gas-_PQvHgy4,634
|
66
67
|
osbot_utils/helpers/Type_Registry.py,sha256=Ajk3SyMSKDi2g9SJYUtTgg7PZkAgydaHcpbGuEN3S94,311
|
67
68
|
osbot_utils/helpers/Zip_Bytes.py,sha256=d5hYXNOJkOaYa7h2CJ0Y3ojEuGTOvCxPuSic2quwMY4,4236
|
@@ -268,14 +269,14 @@ osbot_utils/utils/Csv.py,sha256=oHLVpjRJqrLMz9lubMCNEoThXWju5rNTprcwHc1zq2c,1012
|
|
268
269
|
osbot_utils/utils/Dev.py,sha256=HibpQutYy_iG8gGV8g1GztxNN4l29E4Bi7UZaVL6-L8,1203
|
269
270
|
osbot_utils/utils/Env.py,sha256=9r1xxCDszX1UUOu0dy3Kf_djaU3I39xgB_QdC80Szdo,5669
|
270
271
|
osbot_utils/utils/Exceptions.py,sha256=KyOUHkXQ_6jDTq04Xm261dbEZuRidtsM4dgzNwSG8-8,389
|
271
|
-
osbot_utils/utils/Files.py,sha256=
|
272
|
+
osbot_utils/utils/Files.py,sha256=z-egRBPDYp6AJkZxK-JnXOwz1OezgzEDG_fgSHVcCCM,22427
|
272
273
|
osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
|
273
274
|
osbot_utils/utils/Http.py,sha256=WlXEfgT_NaiDVD7vCDUxy_nOm5Qf8x_L0A3zd8B5tX8,4706
|
274
275
|
osbot_utils/utils/Int.py,sha256=PmlUdU4lSwf4gJdmTVdqclulkEp7KPCVUDO6AcISMF4,116
|
275
276
|
osbot_utils/utils/Json.py,sha256=UNaBazuH1R40fsHjpjuK8kmAANmUHoK9Q0PUeYmgPeY,6254
|
276
277
|
osbot_utils/utils/Json_Cache.py,sha256=mLPkkDZN-3ZVJiDvV1KBJXILtKkTZ4OepzOsDoBPhWg,2006
|
277
|
-
osbot_utils/utils/Lists.py,sha256=
|
278
|
-
osbot_utils/utils/Misc.py,sha256=
|
278
|
+
osbot_utils/utils/Lists.py,sha256=tPz5x5s3sRO97WZ_nsxREBPC5cwaHrhgaYBhsrffTT8,5599
|
279
|
+
osbot_utils/utils/Misc.py,sha256=nODZT6p44B4xYiIiqfEeKYEErQiKR9SGthhGtZWGhkI,16804
|
279
280
|
osbot_utils/utils/Objects.py,sha256=qAWNLISL-gYTl1Ihj4fBSZ9I6n-p-YPUhRZu9YQwqWQ,15235
|
280
281
|
osbot_utils/utils/Png.py,sha256=V1juGp6wkpPigMJ8HcxrPDIP4bSwu51oNkLI8YqP76Y,1172
|
281
282
|
osbot_utils/utils/Process.py,sha256=lr3CTiEkN3EiBx3ZmzYmTKlQoPdkgZBRjPulMxG-zdo,2357
|
@@ -287,8 +288,8 @@ osbot_utils/utils/Toml.py,sha256=dqiegndCJF7V1YT1Tc-b0-Bl6QWyL5q30urmQwMXfMQ,140
|
|
287
288
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
288
289
|
osbot_utils/utils/Zip.py,sha256=riPLKkZJxQjVu8lCm19cOTx5uiLPm1HreB9_BzNXi30,12209
|
289
290
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
290
|
-
osbot_utils/version,sha256=
|
291
|
-
osbot_utils-1.
|
292
|
-
osbot_utils-1.
|
293
|
-
osbot_utils-1.
|
294
|
-
osbot_utils-1.
|
291
|
+
osbot_utils/version,sha256=0nfWeSLY7TCuC1ABX0OW6t1UI9kbFtRJw6PqE6oH7xs,8
|
292
|
+
osbot_utils-1.38.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
293
|
+
osbot_utils-1.38.0.dist-info/METADATA,sha256=aOTN_LvtbeozSVNCqnnkyaHYPbny6vxZJJf2s7DknLs,1266
|
294
|
+
osbot_utils-1.38.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
295
|
+
osbot_utils-1.38.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|