Skip to content

Commit

Permalink
Merge dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DinisCruz committed Jan 3, 2025
2 parents 352bdfe + 58fa1d6 commit 8291e27
Show file tree
Hide file tree
Showing 78 changed files with 556 additions and 207 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Powerful Python util methods and classes that simplify common apis and tasks.

![Current Release](https://img.shields.io/badge/release-v1.96.0-blue)
![Current Release](https://img.shields.io/badge/release-v2.0.2-blue)
[![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)


Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/base_classes/Kwargs_To_Self.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe

# todo: refactor all of Kwargs_To_Self to use Type_Safe
Kwargs_To_Self = Type_Safe
22 changes: 0 additions & 22 deletions osbot_utils/base_classes/Type_Safe__Dict.py

This file was deleted.

22 changes: 0 additions & 22 deletions osbot_utils/base_classes/Type_Safe__List.py

This file was deleted.

4 changes: 2 additions & 2 deletions osbot_utils/context_managers/capture_duration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.utils.Misc import timestamp_utc_now
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.utils.Misc import timestamp_utc_now


class capture_duration(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/decorators/methods/type_safe.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import functools # For wrapping functions
from osbot_utils.helpers.Type_Safe_Method import Type_Safe_Method
from osbot_utils.type_safe.Type_Safe_Method import Type_Safe_Method

def type_safe(func): # Main decorator function
@functools.wraps(func) # Preserve function metadata
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/CFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# - Have code complete on CPrint
# - not have the write the code for each of the methods
# - have a good and logical place to capture the ID of the color
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class CFormat_Colors:
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/Hashicorp_Secrets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osbot_utils.utils.Env import get_env
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.utils.Lists import list_index_by
from osbot_utils.utils.Misc import list_set

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/Zip_Bytes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.utils.Dev import pprint
from osbot_utils.utils.Files import files_list, file_create_from_bytes, temp_file, parent_folder, parent_folder_create
from osbot_utils.utils.Misc import random_text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Row import Cache__Requests__Row
from osbot_utils.helpers.cache_requests.Cache__Requests__Table import Cache__Requests__Table
from osbot_utils.utils.Json import json_dumps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class Cache__Requests__Config(Type_Safe):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import types
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Config import Cache__Requests__Config
from osbot_utils.helpers.cache_requests.Cache__Requests__Table import Cache__Requests__Table
from osbot_utils.utils.Json import json_dumps, json_loads
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import threading
import types

from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Actions import Cache__Requests__Actions
from osbot_utils.helpers.cache_requests.Cache__Requests__Config import Cache__Requests__Config
from osbot_utils.helpers.cache_requests.Cache__Requests__Data import Cache__Requests__Data
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/cache_requests/Cache__Requests__Row.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Config import Cache__Requests__Config
from osbot_utils.helpers.cache_requests.Cache__Requests__Table import Cache__Requests__Table
from osbot_utils.utils.Json import json_dumps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class Cache__Requests__Table(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/Flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing

from osbot_utils.helpers.Dependency_Manager import Dependency_Manager
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_magenta, f_bold
from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config
from osbot_utils.helpers.flows.Flow__Events import flow_events
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/Flow__Events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
from osbot_utils.utils.Str import ansi_to_text
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.flows.models.Flow_Run__Event import Flow_Run__Event
from osbot_utils.helpers.flows.models.Flow_Run__Event_Type import Flow_Run__Event_Type

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from osbot_utils.helpers.flows.Flow__Events import flow_events
from osbot_utils.testing.Stdout import Stdout
from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_red, f_blue, f_bold
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.flows.Flow import Flow

TASK__RANDOM_ID__PREFIX = 'task_id__'
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/models/Flow_Run__Config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class Flow_Run__Config(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/models/Flow_Run__Event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from osbot_utils.helpers.Random_Guid import Random_Guid

from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.Timestamp_Now import Timestamp_Now
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
from osbot_utils.helpers.flows.models.Flow_Run__Event_Type import Flow_Run__Event_Type
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class Flow_Run__Event_Data(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/flows/models/Flow_Run__Event_Type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe

class Flow_Run__Event_Type(Enum):
FLOW_MESSAGE: str = 'flow_message'
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/generators/Generator_Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from types import GeneratorType
from typing import Dict # Typing imports for type hints
from typing import Union
from osbot_utils.base_classes.Type_Safe import Type_Safe # Type_Safe base class for type-safe attributes
from osbot_utils.type_safe.Type_Safe import Type_Safe # Type_Safe base class for type-safe attributes
from osbot_utils.helpers.Random_Guid import Random_Guid # Helper for generating unique IDs
from osbot_utils.helpers.generators.Generator_Context_Manager import Generator_Context_Manager
from osbot_utils.helpers.generators.Model__Generator_State import Model__Generator_State
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/generators/Model__Generator_Target.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from types import GeneratorType
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.Random_Guid import Random_Guid
from osbot_utils.helpers.generators.Model__Generator_State import Model__Generator_State

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/pubsub/Event__Queue.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time
from queue import Queue, Empty
from threading import Thread
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.pubsub.schemas.Schema__Event import Schema__Event
from osbot_utils.helpers.pubsub.schemas.Schema__Event__Message import Schema__Event__Message
from osbot_utils.utils.Misc import random_text, timestamp_utc_now, random_guid
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/sqlite/Sqlite__Database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
from osbot_utils.utils.Files import current_temp_folder, path_combine, folder_create, file_exists, file_delete
from osbot_utils.utils.Misc import random_filename
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import types
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Actions import Cache__Requests__Actions
from osbot_utils.helpers.cache_requests.Cache__Requests__Config import Cache__Requests__Config
from osbot_utils.helpers.cache_requests.Cache__Requests__Data import Cache__Requests__Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.cache_requests.Cache__Requests__Config import Cache__Requests__Config
from osbot_utils.helpers.sqlite.cache.Sqlite__DB__Requests import Sqlite__DB__Requests

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/ssh/SSH.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osbot_utils.base_classes.Kwargs_To_Self import Kwargs_To_Self
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
from osbot_utils.helpers.ssh.SCP import SCP
from osbot_utils.helpers.ssh.SSH__Execute import SSH__Execute
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/ssh/SSH__Execute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.context_managers.capture_duration import capture_duration
from osbot_utils.decorators.lists.group_by import group_by
from osbot_utils.decorators.lists.index_by import index_by
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/ssh/SSH__Python.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.ssh.SSH__Execute import SSH__Execute
from osbot_utils.helpers.ssh.SSH__Linux import SSH__Linux
from osbot_utils.utils.Dev import pprint
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/trace/Trace_Call__Config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.utils.Dev import pprint # todo: fix test requirement of mock to use this method


Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__Attribute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class Xml__Attribute(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__Element.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, List, Union
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.Xml__Attribute import Xml__Attribute

class XML__Element(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__File.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.Xml__Element import XML__Element

class Xml__File(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__File__Load.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from io import StringIO
from typing import List, Union, Dict
from xml.etree.ElementTree import iterparse, Element, fromstring, ParseError
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.Xml__Attribute import Xml__Attribute
from osbot_utils.helpers.xml.Xml__Element import XML__Element
from osbot_utils.helpers.xml.Xml__File import Xml__File
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__File__To_Dict.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, Any
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.Xml__Element import XML__Element
from osbot_utils.helpers.xml.Xml__File import Xml__File

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/Xml__File__To_Xml.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional
from xml.etree.ElementTree import Element, SubElement, tostring
from xml.dom import minidom
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.Xml__Element import XML__Element
from osbot_utils.helpers.xml.Xml__File import Xml__File

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/rss/RSS__Channel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Any, Dict, List
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.rss.RSS__Image import RSS__Image
from osbot_utils.helpers.xml.rss.RSS__Item import RSS__Item

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/rss/RSS__Enclosure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe


class RSS__Enclosure(Type_Safe):
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/rss/RSS__Feed.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, Any
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.xml.rss.RSS__Channel import RSS__Channel

DEFAULT__RSS_FEED__VERSION = "2.0"
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/rss/RSS__Image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe

class RSS__Image(Type_Safe):
url : str
Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/helpers/xml/rss/RSS__Item.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, List, Any
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.helpers.Guid import Guid
from osbot_utils.helpers.xml.rss.RSS__Enclosure import RSS__Enclosure

Expand Down
2 changes: 1 addition & 1 deletion osbot_utils/testing/Temp_Env_Vars.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from osbot_utils.base_classes.Type_Safe import Type_Safe
from osbot_utils.type_safe.Type_Safe import Type_Safe
from osbot_utils.utils.Env import del_env, set_env


Expand Down
Loading

0 comments on commit 8291e27

Please sign in to comment.