#wip: Autoportable Python version.
This commit is contained in:
parent
f642ad8b22
commit
922f995022
@ -53,7 +53,9 @@
|
|||||||
|
|
||||||
"AnP_ControllersManager_start" : null,
|
"AnP_ControllersManager_start" : null,
|
||||||
"default_controllers" : {
|
"default_controllers" : {
|
||||||
"ai" : "AIController"
|
"ai" : "AIController",
|
||||||
|
"clonations_processes" : "CloneController",
|
||||||
|
"ai_translate" : "AITranslateController"
|
||||||
},
|
},
|
||||||
"AnP_ControllersManager_end" : null,
|
"AnP_ControllersManager_end" : null,
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,12 @@
|
|||||||
"Lista de títulos a evaluar: \n{list}"
|
"Lista de títulos a evaluar: \n{list}"
|
||||||
],
|
],
|
||||||
"ai_controller_response_system" : "Usa las siguientes guías para responder y dar soporte.{loras}",
|
"ai_controller_response_system" : "Usa las siguientes guías para responder y dar soporte.{loras}",
|
||||||
"AnP_AIController_end" : null
|
"AnP_AIController_end" : null,
|
||||||
|
|
||||||
|
"AnP_CloneController_start" : null,
|
||||||
|
"anp_clone_controller_file_cloned" : "El archivo '{file}' ha sido clonado desde '{from_path}' a '{to_path}'.",
|
||||||
|
"anp_clone_controller_file_deleted" : "El archivo '{file}' ha sido eliminado de '{to_path}'.",
|
||||||
|
"AnP_CloneController_end" : null
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +338,8 @@ export const Common = (function(){
|
|||||||
master = (
|
master = (
|
||||||
Check.is_html_item(inputs[0]) ? inputs[0] :
|
Check.is_html_item(inputs[0]) ? inputs[0] :
|
||||||
Check.is_string(inputs[0]) ? document.querySelector(inputs[0]) :
|
Check.is_string(inputs[0]) ? document.querySelector(inputs[0]) :
|
||||||
null);
|
null),
|
||||||
|
items = [];
|
||||||
|
|
||||||
(master ? inputs.slice(1) : inputs).forEach(subinputs => {
|
(master ? inputs.slice(1) : inputs).forEach(subinputs => {
|
||||||
if(Check.is_html_item(subinputs))
|
if(Check.is_html_item(subinputs))
|
||||||
@ -371,9 +372,10 @@ export const Common = (function(){
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
items.push(...fragment.childNodes);
|
||||||
master && master.appendChild(fragment);
|
master && master.appendChild(fragment);
|
||||||
|
|
||||||
return [...fragment.childNodes];
|
return items;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
from typing import Any, Self, Sequence, Optional, Callable
|
from typing import Any, Self, Sequence, Optional, Callable
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Models.AIResponseModel import AIResponseModel
|
from AnP.Models.AIResponseModel import AIResponseModel
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class AIInterpretersAbstract(ABC):
|
class AIInterpretersAbstract(ABC):
|
||||||
|
|
||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Optional, Sequence
|
from typing import Self, Any, Optional, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
|
|
||||||
class ControllerAbstract(ModelAbstract):
|
class ControllerAbstract(ModelAbstract):
|
||||||
|
|
||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Optional, Sequence
|
from typing import Self, Any, Optional, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
|
|
||||||
class DispatchAbstract(ModelAbstract):
|
class DispatchAbstract(ModelAbstract):
|
||||||
|
|
||||||
@ -4,10 +4,10 @@
|
|||||||
from typing import Any, Optional, Self, Sequence
|
from typing import Any, Optional, Self, Sequence
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from os.path import dirname as directory_name, abspath as absolute_path
|
from os.path import dirname as directory_name, abspath as absolute_path
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
|
|
||||||
class FilesAbstract(ABC):
|
class FilesAbstract(ABC):
|
||||||
|
|
||||||
@ -93,3 +93,6 @@ class FilesAbstract(ABC):
|
|||||||
results.extend(self.load_json(json, only_dictionaries))
|
results.extend(self.load_json(json, only_dictionaries))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def list_directory_items(self:Self, path:str) -> list[str]:pass
|
||||||
@ -5,8 +5,8 @@ from abc import ABC, abstractmethod
|
|||||||
from typing import Any, Self, Optional, Sequence
|
from typing import Any, Self, Optional, Sequence
|
||||||
from re import Match as REMath
|
from re import Match as REMath
|
||||||
import datetime
|
import datetime
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class HTTPServersAbstract(ABC):
|
class HTTPServersAbstract(ABC):
|
||||||
|
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
from typing import Any, Self, Optional, Sequence
|
from typing import Any, Self, Optional, Sequence
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Application.Event import Event
|
from AnP.Application.Event import Event
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class WebSocketServersAbstract(ABC):
|
class WebSocketServersAbstract(ABC):
|
||||||
|
|
||||||
@ -6,26 +6,26 @@ import datetime
|
|||||||
from re import Match as REMatch
|
from re import Match as REMatch
|
||||||
from traceback import extract_tb as extract_traceback, format_stack as trace_format_stack
|
from traceback import extract_tb as extract_traceback, format_stack as trace_format_stack
|
||||||
from time import time as timestamp, sleep
|
from time import time as timestamp, sleep
|
||||||
from Abstracts.FilesAbstract import FilesAbstract
|
from AnP.Abstracts.FilesAbstract import FilesAbstract
|
||||||
from Drivers.FilesDriver import FilesDriver
|
from AnP.Drivers.FilesDriver import FilesDriver
|
||||||
from Managers.I18NManager import I18NManager
|
from AnP.Managers.I18NManager import I18NManager
|
||||||
from Managers.SettingsManager import SettingsManager
|
from AnP.Managers.SettingsManager import SettingsManager
|
||||||
from Managers.PrintTypesManager import PrintTypesManager
|
from AnP.Managers.PrintTypesManager import PrintTypesManager
|
||||||
from Managers.TerminalManager import TerminalManager
|
from AnP.Managers.TerminalManager import TerminalManager
|
||||||
from Managers.ModelsManager import ModelsManager
|
from AnP.Managers.ModelsManager import ModelsManager
|
||||||
from Managers.UniqueKeysManager import UniqueKeysManager
|
from AnP.Managers.UniqueKeysManager import UniqueKeysManager
|
||||||
from Managers.QueusManager import QueuesManager
|
from AnP.Managers.QueusManager import QueuesManager
|
||||||
from Managers.SessionsManager import SessionsManager
|
from AnP.Managers.SessionsManager import SessionsManager
|
||||||
from Managers.ControllersManager import ControllersManager
|
from AnP.Managers.ControllersManager import ControllersManager
|
||||||
from Managers.DispatchesManager import DispatchesManager
|
from AnP.Managers.DispatchesManager import DispatchesManager
|
||||||
from Managers.IndexesManager import IndexesManager
|
from AnP.Managers.IndexesManager import IndexesManager
|
||||||
from Managers.RoutesManager import RoutesManager
|
from AnP.Managers.RoutesManager import RoutesManager
|
||||||
from Managers.WebSocketServersManager import WebSocketServersManager
|
from AnP.Managers.WebSocketServersManager import WebSocketServersManager
|
||||||
from Managers.HTTPServersManager import HTTPServersManager
|
from AnP.Managers.HTTPServersManager import HTTPServersManager
|
||||||
from Managers.PseudoLoRAsManager import PseudoLoRAsManager
|
from AnP.Managers.PseudoLoRAsManager import PseudoLoRAsManager
|
||||||
from Managers.AIInterpretersManager import AIInterpretersManager
|
from AnP.Managers.AIInterpretersManager import AIInterpretersManager
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
|
|
||||||
class AnP:
|
class AnP:
|
||||||
|
|
||||||
@ -2,11 +2,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Callable
|
from typing import Self, Callable
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
from Abstracts.ControllerAbstract import ControllerAbstract
|
from AnP.Abstracts.ControllerAbstract import ControllerAbstract
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
from Models.AIResponseModel import AIResponseModel
|
from AnP.Models.AIResponseModel import AIResponseModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class AIController(ControllerAbstract, ModelAbstract):
|
class AIController(ControllerAbstract, ModelAbstract):
|
||||||
|
|
||||||
11
Python/AnP/Controllers/AITranslateController.py
Normal file
11
Python/AnP/Controllers/AITranslateController.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from typing import Self
|
||||||
|
from AnP.Abstracts.ControllerAbstract import ControllerAbstract
|
||||||
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
|
||||||
|
class AITranslateController(ControllerAbstract):
|
||||||
|
|
||||||
|
def translate(self:Self, request:RequestModel) -> None:
|
||||||
|
pass
|
||||||
83
Python/AnP/Controllers/CloneController.py
Normal file
83
Python/AnP/Controllers/CloneController.py
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from typing import Self
|
||||||
|
from threading import Thread
|
||||||
|
from AnP.Abstracts.ControllerAbstract import ControllerAbstract
|
||||||
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
from AnP.Models.HashModel import HashModel
|
||||||
|
|
||||||
|
class CloneController(ControllerAbstract):
|
||||||
|
|
||||||
|
def __clone_subdirectory(self:Self, from_path:str, to_path:str, hashes:dict[str, HashModel], ignore:list[str]) -> None:
|
||||||
|
|
||||||
|
item:str
|
||||||
|
current_items:list[str] = self.anp.files.list_directory_items(to_path, True)
|
||||||
|
|
||||||
|
if not self.anp.files.exists(to_path):
|
||||||
|
self.anp.files.make_directory(to_path)
|
||||||
|
|
||||||
|
for item in self.anp.files.list_directory_items(from_path, True):
|
||||||
|
|
||||||
|
if item in current_items:
|
||||||
|
current_items.remove(item)
|
||||||
|
|
||||||
|
if item in ignore or item in (".", ".."):
|
||||||
|
continue
|
||||||
|
|
||||||
|
from_item_path:str = f"{from_path}/{item}"
|
||||||
|
to_item_path:str = f"{to_path}/{item}"
|
||||||
|
|
||||||
|
if self.anp.files.is_directory(from_item_path):
|
||||||
|
self.__clone_subdirectory(from_item_path, to_item_path, hashes, ignore)
|
||||||
|
elif self.anp.files.is_file(from_item_path):
|
||||||
|
|
||||||
|
data:bytes = self.anp.files.load(from_item_path, "rb")
|
||||||
|
hash:HashModel = HashModel(data)
|
||||||
|
|
||||||
|
if self.anp.files.exists(to_item_path) and to_item_path not in hashes:
|
||||||
|
hashes[to_item_path] = HashModel(self.anp.files.load(to_item_path, "rb"))
|
||||||
|
|
||||||
|
if to_item_path not in hashes or not hash.compare(hashes[to_item_path]):
|
||||||
|
self.anp.files.save(to_item_path, data)
|
||||||
|
hashes[to_item_path] = hash
|
||||||
|
self.anp.print("info", "anp_clone_controller_file_cloned", {
|
||||||
|
"from_item_path" : from_item_path,
|
||||||
|
"to_item_path" : to_item_path,
|
||||||
|
"from_path" : from_path,
|
||||||
|
"to_path" : to_path,
|
||||||
|
"file" : item
|
||||||
|
})
|
||||||
|
|
||||||
|
for item in current_items:
|
||||||
|
self.anp.files.delete(f"{to_path}/{item}")
|
||||||
|
self.anp.print("info", "anp_clone_controller_file_deleted", {
|
||||||
|
"to_item_path" : f"{to_path}/{item}",
|
||||||
|
"to_path" : to_path,
|
||||||
|
"file" : item
|
||||||
|
})
|
||||||
|
|
||||||
|
def __clone_process(self:Self, from_path:str, to_path:str, waiter:int|float, ignore:list[str]) -> None:
|
||||||
|
|
||||||
|
hashes:dict[str, HashModel] = {}
|
||||||
|
waiter /= 1000.0
|
||||||
|
|
||||||
|
while self.anp.working():
|
||||||
|
self.__clone_subdirectory(from_path, to_path, hashes, ignore)
|
||||||
|
self.anp.wait(waiter)
|
||||||
|
|
||||||
|
def __clone_directory(self:Self, from_path:str, to_path:str, waiter:int|float, ignore:list[str]) -> None:
|
||||||
|
Thread(target = self.__clone_process, args = (from_path, to_path, waiter, ignore)).start()
|
||||||
|
|
||||||
|
def clone(self:Self, request:RequestModel) -> None: # Not use from Routes.
|
||||||
|
self.__clone_directory(request.get("from_path", ""), request.get("to_path", ""), request.get("waiter", 5000), request.get("ignore", []))
|
||||||
|
|
||||||
|
def execute(self:Self, _) -> None: # Not use from Routes.
|
||||||
|
|
||||||
|
from_path:str
|
||||||
|
to_path:str
|
||||||
|
waiter:int|float
|
||||||
|
ignore:list[str]
|
||||||
|
|
||||||
|
for (from_path, to_path, waiter, ignore) in self.anp.settings.get("clonations_processes", []):
|
||||||
|
self.__clone_directory(from_path, to_path, waiter, ignore)
|
||||||
@ -3,10 +3,17 @@
|
|||||||
|
|
||||||
from typing import Self
|
from typing import Self
|
||||||
from os.path import isfile as is_file, isdir as is_directory, exists as path_exists
|
from os.path import isfile as is_file, isdir as is_directory, exists as path_exists
|
||||||
from os import unlink as delete_path, mkdir as make_directory
|
from os import (
|
||||||
from Abstracts.FilesAbstract import FilesAbstract
|
unlink as delete_symbolic_link,
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
remove as delete_file,
|
||||||
from Utils.Checks import Check
|
# rmdir as remove_directory,
|
||||||
|
mkdir as make_directory,
|
||||||
|
listdir as list_directory_items
|
||||||
|
)
|
||||||
|
from shutil import rmtree as remove_directory
|
||||||
|
from AnP.Abstracts.FilesAbstract import FilesAbstract
|
||||||
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class FilesDriver(FilesAbstract, ModelAbstract):
|
class FilesDriver(FilesAbstract, ModelAbstract):
|
||||||
|
|
||||||
@ -87,7 +94,12 @@ class FilesDriver(FilesAbstract, ModelAbstract):
|
|||||||
|
|
||||||
if absolute_path:
|
if absolute_path:
|
||||||
try:
|
try:
|
||||||
delete_path(absolute_path)
|
if is_file(absolute_path):
|
||||||
|
delete_file(absolute_path)
|
||||||
|
elif is_directory(absolute_path):
|
||||||
|
remove_directory(absolute_path)
|
||||||
|
else:
|
||||||
|
delete_symbolic_link(absolute_path)
|
||||||
return True
|
return True
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
self.anp.exception(exception, "anp_files_driver_delete_exception", {
|
self.anp.exception(exception, "anp_files_driver_delete_exception", {
|
||||||
@ -95,3 +107,21 @@ class FilesDriver(FilesAbstract, ModelAbstract):
|
|||||||
"absolute_path" : absolute_path
|
"absolute_path" : absolute_path
|
||||||
})
|
})
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def list_directory_items(self:Self, path:str, only_names:bool = True) -> list[str]:
|
||||||
|
|
||||||
|
items:list[str] = []
|
||||||
|
absolute_path:str = self.get_absolute_path(path)
|
||||||
|
|
||||||
|
if absolute_path is not None and self.is_directory(absolute_path):
|
||||||
|
try:
|
||||||
|
if only_names:
|
||||||
|
items.extend(list_directory_items(absolute_path))
|
||||||
|
else:
|
||||||
|
items.extend([f"{absolute_path}{self._slash}{item}" for item in list_directory_items(absolute_path)])
|
||||||
|
except Exception as exception:
|
||||||
|
self.anp.exception(exception, "anp_files_driver_list_directory_items_exception", {
|
||||||
|
"path" : path,
|
||||||
|
"only_names" : only_names
|
||||||
|
})
|
||||||
|
return items
|
||||||
@ -2,13 +2,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Optional, Self, Sequence
|
from typing import Any, Optional, Self, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
|
||||||
from Models.RequestModel import RequestModel
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
from Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
from AnP.Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
||||||
|
|
||||||
class HTTPServerDriver(HTTPServersAbstract, ModelAbstract):
|
class HTTPServerDriver(HTTPServersAbstract, ModelAbstract):
|
||||||
|
|
||||||
@ -11,12 +11,12 @@ from socket import (
|
|||||||
SO_REUSEADDR as SOCKET_REUSE_ADDRESS
|
SO_REUSEADDR as SOCKET_REUSE_ADDRESS
|
||||||
)
|
)
|
||||||
import datetime
|
import datetime
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
from AnP.Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
|
|
||||||
class HTTPSocketServerDriver(HTTPServersAbstract):
|
class HTTPSocketServerDriver(HTTPServersAbstract):
|
||||||
|
|
||||||
@ -4,12 +4,12 @@
|
|||||||
from typing import Any, Optional, Self, Sequence, Callable
|
from typing import Any, Optional, Self, Sequence, Callable
|
||||||
from requests import post as Post, Response
|
from requests import post as Post, Response
|
||||||
# from pydantic import BaseModel
|
# from pydantic import BaseModel
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.AIInterpretersAbstract import AIInterpretersAbstract
|
from AnP.Abstracts.AIInterpretersAbstract import AIInterpretersAbstract
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
from Models.AIResponseModel import AIResponseModel
|
from AnP.Models.AIResponseModel import AIResponseModel
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class OllamaDriver(AIInterpretersAbstract, ModelAbstract):
|
class OllamaDriver(AIInterpretersAbstract, ModelAbstract):
|
||||||
|
|
||||||
@ -4,12 +4,12 @@
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Any, Self, Sequence, Optional
|
from typing import Any, Self, Sequence, Optional
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
from Abstracts.WebSocketServersAbstract import WebSocketServersAbstract
|
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
|
||||||
from websockets.sync.server import serve as server_serve
|
from websockets.sync.server import serve as server_serve
|
||||||
from websockets import Server as WebSocketServer, ClientConnection as WebSocketClient
|
from websockets import Server as WebSocketServer, ClientConnection as WebSocketClient
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Abstracts.WebSocketServersAbstract import WebSocketServersAbstract
|
||||||
from Utils.Checks import Check
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class WebSocketServerDriver(WebSocketServersAbstract, ModelAbstract):
|
class WebSocketServerDriver(WebSocketServersAbstract, ModelAbstract):
|
||||||
|
|
||||||
@ -3,23 +3,23 @@
|
|||||||
|
|
||||||
from typing import Any, Optional, Sequence, Self
|
from typing import Any, Optional, Sequence, Self
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Interfaces.Managers.SettingsManagerInterface import SettingsManagerInterface
|
from AnP.Interfaces.Managers.SettingsManagerInterface import SettingsManagerInterface
|
||||||
from Interfaces.Managers.I18NManagerInterface import I18NManagerInterface
|
from AnP.Interfaces.Managers.I18NManagerInterface import I18NManagerInterface
|
||||||
from Interfaces.Managers.PrintTypesManagerInterface import PrintTypesManagerInterface
|
from AnP.Interfaces.Managers.PrintTypesManagerInterface import PrintTypesManagerInterface
|
||||||
from Interfaces.Managers.TerminalManagerInterface import TerminalManagerInterface
|
from AnP.Interfaces.Managers.TerminalManagerInterface import TerminalManagerInterface
|
||||||
from Interfaces.Abstracts.FilesAbstractInterface import FilesAbstractInterface
|
from AnP.Interfaces.Abstracts.FilesAbstractInterface import FilesAbstractInterface
|
||||||
from Interfaces.Managers.ModelsManagerInterface import ModelsManagerInterface
|
from AnP.Interfaces.Managers.ModelsManagerInterface import ModelsManagerInterface
|
||||||
from Interfaces.Managers.UniqueKeysManagerInterface import UniqueKeysManagerInterface
|
from AnP.Interfaces.Managers.UniqueKeysManagerInterface import UniqueKeysManagerInterface
|
||||||
from Interfaces.Managers.QueusManagerInterface import QueusManagerInterface
|
from AnP.Interfaces.Managers.QueusManagerInterface import QueusManagerInterface
|
||||||
from Interfaces.Managers.SessionsManagerInterface import SessionsManagerInterface
|
from AnP.Interfaces.Managers.SessionsManagerInterface import SessionsManagerInterface
|
||||||
from Interfaces.Managers.ControllersManagerInterface import ControllersManagerInterface
|
from AnP.Interfaces.Managers.ControllersManagerInterface import ControllersManagerInterface
|
||||||
from Interfaces.Managers.DispatchesManagerInterface import DispatchesManagerInterface
|
from AnP.Interfaces.Managers.DispatchesManagerInterface import DispatchesManagerInterface
|
||||||
from Interfaces.Managers.IndexesManagerInterface import IndexesManagerInterface
|
from AnP.Interfaces.Managers.IndexesManagerInterface import IndexesManagerInterface
|
||||||
from Interfaces.Managers.RoutesManagerInterface import RoutesManagerInterface
|
from AnP.Interfaces.Managers.RoutesManagerInterface import RoutesManagerInterface
|
||||||
from Interfaces.Managers.WebSocketServersManagerInterface import WebSocketServersManagerInterface
|
from AnP.Interfaces.Managers.WebSocketServersManagerInterface import WebSocketServersManagerInterface
|
||||||
from Interfaces.Managers.HTTPServersManagerInterface import HTTPServersManagerInterface
|
from AnP.Interfaces.Managers.HTTPServersManagerInterface import HTTPServersManagerInterface
|
||||||
from Interfaces.Managers.PseudoLoRAsManagerInterface import PseudoLoRAsManagerInterface
|
from AnP.Interfaces.Managers.PseudoLoRAsManagerInterface import PseudoLoRAsManagerInterface
|
||||||
from Interfaces.Managers.AIInterpretersManagerInterface import AIInterpretersManagerInterface
|
from AnP.Interfaces.Managers.AIInterpretersManagerInterface import AIInterpretersManagerInterface
|
||||||
|
|
||||||
class AnPInterface(ABC):
|
class AnPInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Any, Callable, Self, Optional
|
from typing import Any, Callable, Self, Optional
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Models.AIResponseModel import AIResponseModel
|
from AnP.Models.AIResponseModel import AIResponseModel
|
||||||
|
|
||||||
class AIInterpretersManagerInterface(ABC):
|
class AIInterpretersManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
|
||||||
class ControllersManagerInterface(ABC):
|
class ControllersManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Self, Sequence, Any
|
from typing import Self, Sequence, Any
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Interfaces.Abstracts.HTTPServersAbstractInterface import HTTPServersAbstractInterface
|
from AnP.Interfaces.Abstracts.HTTPServersAbstractInterface import HTTPServersAbstractInterface
|
||||||
|
|
||||||
class HTTPServersManagerInterface(ABC):
|
class HTTPServersManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Self, Any, Callable
|
from typing import Self, Any, Callable
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Models.PseudoLoRAModel import PseudoLoRAModel
|
from AnP.Models.PseudoLoRAModel import PseudoLoRAModel
|
||||||
|
|
||||||
class PseudoLoRAsManagerInterface(ABC):
|
class PseudoLoRAsManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Self, Any
|
from typing import Self, Any
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
|
||||||
class RoutesManagerInterface(ABC):
|
class RoutesManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Self, Optional, Any
|
from typing import Self, Optional, Any
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Models.SessionModel import SessionModel
|
from AnP.Models.SessionModel import SessionModel
|
||||||
|
|
||||||
class SessionsManagerInterface(ABC):
|
class SessionsManagerInterface(ABC):
|
||||||
|
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
from typing import Any, Self, Optional, Sequence
|
from typing import Any, Self, Optional, Sequence
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from Interfaces.Abstracts.WebSocketServersAbstractInterface import WebSocketServersAbstractInterface
|
from AnP.Interfaces.Abstracts.WebSocketServersAbstractInterface import WebSocketServersAbstractInterface
|
||||||
from Application.Event import Event
|
from AnP.Application.Event import Event
|
||||||
|
|
||||||
class WebSocketServersManagerInterface(ABC):
|
class WebSocketServersManagerInterface(ABC):
|
||||||
|
|
||||||
@ -2,10 +2,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Callable, Self, Optional
|
from typing import Any, Callable, Self, Optional
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.AIInterpretersAbstract import AIInterpretersAbstract
|
from AnP.Abstracts.AIInterpretersAbstract import AIInterpretersAbstract
|
||||||
from Models.AIResponseModel import AIResponseModel
|
from AnP.Models.AIResponseModel import AIResponseModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class AIInterpretersManager:
|
class AIInterpretersManager:
|
||||||
|
|
||||||
@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Self, Sequence
|
from typing import Any, Self
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.ControllerAbstract import ControllerAbstract
|
from AnP.Abstracts.ControllerAbstract import ControllerAbstract
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Checks import Check
|
|
||||||
|
|
||||||
class ControllersManager:
|
class ControllersManager:
|
||||||
|
|
||||||
@ -2,10 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.DispatchAbstract import DispatchAbstract
|
from AnP.Abstracts.DispatchAbstract import DispatchAbstract
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Checks import Check
|
|
||||||
|
|
||||||
class DispatchesManager:
|
class DispatchesManager:
|
||||||
|
|
||||||
@ -2,10 +2,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Sequence, Any
|
from typing import Self, Sequence, Any
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
from AnP.Abstracts.HTTPServersAbstract import HTTPServersAbstract
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class HTTPServersManager:
|
class HTTPServersManager:
|
||||||
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Optional, Self, Sequence
|
from typing import Any, Optional, Self, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class I18NManager:
|
class I18NManager:
|
||||||
|
|
||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any
|
from typing import Self, Any
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class IndexesManager:
|
class IndexesManager:
|
||||||
|
|
||||||
@ -2,10 +2,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Sequence, TypeVar
|
from typing import Self, Any, Sequence, TypeVar
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.ModelAbstract import ModelAbstract
|
from AnP.Abstracts.ModelAbstract import ModelAbstract
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
T = TypeVar("T", bound = ModelAbstract)
|
T = TypeVar("T", bound = ModelAbstract)
|
||||||
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Self, Sequence
|
from typing import Any, Self, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class PrintTypesManager:
|
class PrintTypesManager:
|
||||||
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Sequence, Callable, Optional
|
from typing import Self, Any, Sequence, Callable, Optional
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Models.PseudoLoRAModel import PseudoLoRAModel
|
from AnP.Models.PseudoLoRAModel import PseudoLoRAModel
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class PseudoLoRAsManager:
|
class PseudoLoRAsManager:
|
||||||
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Callable, Optional, Sequence
|
from typing import Self, Any, Callable, Optional, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Models.QueuesModel import QueuesModel
|
from AnP.Models.QueuesModel import QueuesModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class QueuesManager:
|
class QueuesManager:
|
||||||
|
|
||||||
@ -1,13 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import re
|
|
||||||
from typing import Self, Any
|
from typing import Self, Any
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Models.RouteModel import RouteModel
|
from AnP.Models.RouteModel import RouteModel
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class RoutesManager:
|
class RoutesManager:
|
||||||
|
|
||||||
@ -4,8 +4,8 @@
|
|||||||
from typing import Self, Optional, Any
|
from typing import Self, Optional, Any
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import time as timestamp
|
from time import time as timestamp
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Models.SessionModel import SessionModel
|
from AnP.Models.SessionModel import SessionModel
|
||||||
|
|
||||||
class SessionsManager:
|
class SessionsManager:
|
||||||
|
|
||||||
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Optional, Self, Sequence
|
from typing import Any, Optional, Self, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class SettingsManager:
|
class SettingsManager:
|
||||||
|
|
||||||
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Callable, Any, Optional
|
from typing import Self, Any, Optional
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Models.CommandModel import CommandModel
|
from AnP.Models.CommandModel import CommandModel
|
||||||
|
|
||||||
class TerminalManager:
|
class TerminalManager:
|
||||||
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any
|
from typing import Self
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class UniqueKeysManager:
|
class UniqueKeysManager:
|
||||||
|
|
||||||
@ -2,12 +2,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Self, Optional, Sequence
|
from typing import Any, Self, Optional, Sequence
|
||||||
from Interfaces.Application.AnPInterface import AnPInterface
|
from AnP.Interfaces.Application.AnPInterface import AnPInterface
|
||||||
from Abstracts.WebSocketServersAbstract import WebSocketServersAbstract
|
from AnP.Abstracts.WebSocketServersAbstract import WebSocketServersAbstract
|
||||||
from Application.Event import Event
|
from AnP.Application.Event import Event
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class WebSocketServersManager:
|
class WebSocketServersManager:
|
||||||
|
|
||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any, Callable, Optional, Self, Sequence
|
from typing import Any, Callable, Optional, Self, Sequence
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
class CommandModel:
|
class CommandModel:
|
||||||
|
|
||||||
73
Python/AnP/Models/HashModel.py
Normal file
73
Python/AnP/Models/HashModel.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from hashlib import md5, sha1, sha256, blake2b
|
||||||
|
from zlib import crc32
|
||||||
|
from typing import Self, Protocol
|
||||||
|
from AnP.Utils.Checks import Check
|
||||||
|
|
||||||
|
class HashAlgorithm(Protocol):
|
||||||
|
def update(self:Self, data:bytes) -> None: ...
|
||||||
|
def hexdigest(self:Self) -> str: ...
|
||||||
|
|
||||||
|
class CRC32HashAlgorithm(HashAlgorithm):
|
||||||
|
|
||||||
|
def __init__(self:Self) -> None:
|
||||||
|
self.__value:int = 0
|
||||||
|
|
||||||
|
def update(self:Self, data:bytes) -> None:
|
||||||
|
self.__value = crc32(data, self.__value)
|
||||||
|
|
||||||
|
def hexdigest(self:Self) -> str:
|
||||||
|
return f"{self.__value & 0xFFFFFFFF:08x}"
|
||||||
|
|
||||||
|
class HashModel():
|
||||||
|
|
||||||
|
def __init__(self:Self, data:bytes = b"", chunk_size:int = 4096) -> None:
|
||||||
|
|
||||||
|
self.__chunk_size:int = chunk_size
|
||||||
|
self.md5:str = ""
|
||||||
|
self.sha1:str = ""
|
||||||
|
self.sha256:str = ""
|
||||||
|
self.blake2b:str = ""
|
||||||
|
self.crc32:str = ""
|
||||||
|
self.__hashes:list[HashAlgorithm] = ["md5", "sha1", "sha256", "blake2b", "crc32"]
|
||||||
|
self.__algorithms:list[HashAlgorithm] = [
|
||||||
|
method() for method in (md5, sha1, sha256, blake2b, CRC32HashAlgorithm)
|
||||||
|
]
|
||||||
|
|
||||||
|
len(data) and self.update(data)
|
||||||
|
|
||||||
|
def __update_chunk(self:Self, chunk:bytes) -> None:
|
||||||
|
for hash_algorithm in self.__algorithms:
|
||||||
|
hash_algorithm.update(chunk)
|
||||||
|
|
||||||
|
def update(self:Self, data:bytes|str, encode:str = "utf-8") -> None:
|
||||||
|
|
||||||
|
done:bool = False
|
||||||
|
|
||||||
|
if Check.is_string(data):
|
||||||
|
data = data.encode(encode)
|
||||||
|
|
||||||
|
if Check.is_binary(data):
|
||||||
|
|
||||||
|
while data:
|
||||||
|
|
||||||
|
chunk:bytes = data[:self.__chunk_size]
|
||||||
|
|
||||||
|
data = data[self.__chunk_size:]
|
||||||
|
self.__update_chunk(chunk)
|
||||||
|
|
||||||
|
done = True
|
||||||
|
|
||||||
|
if done:
|
||||||
|
|
||||||
|
name:str
|
||||||
|
|
||||||
|
for name in self.__hashes:
|
||||||
|
setattr(self, name, getattr(self.__algorithms[self.__hashes.index(name)], "hexdigest")())
|
||||||
|
|
||||||
|
return done
|
||||||
|
|
||||||
|
def compare(self:Self, other:Self) -> bool:
|
||||||
|
return all(getattr(self, name) == getattr(other, name) for name in self.__hashes)
|
||||||
@ -2,8 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Self, Any, Sequence, Optional
|
from typing import Self, Any, Sequence, Optional
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class PseudoLoRAModel:
|
class PseudoLoRAModel:
|
||||||
|
|
||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
from typing import Self, Any, Callable, Sequence, Optional
|
from typing import Self, Any, Callable, Sequence, Optional
|
||||||
from threading import Thread, Lock
|
from threading import Thread, Lock
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class QueueItemModel:
|
class QueueItemModel:
|
||||||
def __init__(self:Self, i:int, callback:Callable[[Callable[[], None]], None], *arguments:list[Any|None]) -> None:
|
def __init__(self:Self, i:int, callback:Callable[[Callable[[], None]], None], *arguments:list[Any|None]) -> None:
|
||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
from typing import Any, Self, Callable, Sequence, Optional
|
from typing import Any, Self, Callable, Sequence, Optional
|
||||||
from json import dumps as json_encode
|
from json import dumps as json_encode
|
||||||
from Models.SessionModel import SessionModel
|
from AnP.Models.SessionModel import SessionModel
|
||||||
from Abstracts.RouteAbstract import RouteAbstract
|
from AnP.Abstracts.RouteAbstract import RouteAbstract
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
|
|
||||||
class RequestModel:
|
class RequestModel:
|
||||||
|
|
||||||
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
from typing import Self, Any, Sequence, Callable
|
from typing import Self, Any, Sequence, Callable
|
||||||
from re import Match as REMatch, Pattern as REPattern, compile as re_compile
|
from re import Match as REMatch, Pattern as REPattern, compile as re_compile
|
||||||
from Abstracts.RouteAbstract import RouteAbstract
|
from AnP.Abstracts.RouteAbstract import RouteAbstract
|
||||||
from Utils.Common import Common
|
from AnP.Utils.Common import Common
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
from Models.RequestModel import RequestModel
|
from AnP.Models.RequestModel import RequestModel
|
||||||
|
|
||||||
class RouteModel(RouteAbstract):
|
class RouteModel(RouteAbstract):
|
||||||
|
|
||||||
@ -5,7 +5,7 @@ from typing import Any, Self, Sequence
|
|||||||
from re import Pattern as REPattern
|
from re import Pattern as REPattern
|
||||||
from os.path import isfile as is_file
|
from os.path import isfile as is_file
|
||||||
from json import loads as json_decode
|
from json import loads as json_decode
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
|
|
||||||
class Check:
|
class Check:
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class Check:
|
|||||||
|
|
||||||
mark:str
|
mark:str
|
||||||
|
|
||||||
for mark in cls.get_keys(marks):
|
for mark in marks if Check.is_array(marks) else (marks,):
|
||||||
if key.startswith(mark + "_") and (
|
if key.startswith(mark + "_") and (
|
||||||
key.endswith("_start") or
|
key.endswith("_start") or
|
||||||
key.endswith("_end")
|
key.endswith("_end")
|
||||||
@ -11,8 +11,8 @@ from inspect import FrameInfo, stack as get_stack
|
|||||||
from json import dumps as json_encode, loads as json_decode
|
from json import dumps as json_encode, loads as json_decode
|
||||||
from base64 import b64encode as base64_encode, b64decode as base64_decode
|
from base64 import b64encode as base64_encode, b64decode as base64_decode
|
||||||
from random import choice as random_choice
|
from random import choice as random_choice
|
||||||
from Utils.Checks import Check
|
from AnP.Utils.Checks import Check
|
||||||
from Utils.Patterns import RE
|
from AnP.Utils.Patterns import RE
|
||||||
|
|
||||||
ROOT_PATH:str = absolute_path(directory_name(__file__))
|
ROOT_PATH:str = absolute_path(directory_name(__file__))
|
||||||
SLASH:str = "/" if "/" in ROOT_PATH else "\\\\"
|
SLASH:str = "/" if "/" in ROOT_PATH else "\\\\"
|
||||||
0
Python/AnP/__init__.py
Normal file
0
Python/AnP/__init__.py
Normal file
39
Python/base.py
Normal file
39
Python/base.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
from AnP.Controllers.AIController import AIController
|
||||||
|
from AnP.Drivers.WebSocketServerDriver import WebSocketServerDriver
|
||||||
|
from AnP.Drivers.HTTPSocketServerDriver import HTTPSocketServerDriver
|
||||||
|
from AnP.Drivers.HTTPServerDriver import HTTPServerDriver
|
||||||
|
from AnP.Drivers.OllamaDriver import OllamaDriver
|
||||||
|
from AnP.Drivers.FilesDriver import FilesDriver
|
||||||
|
from AnP.Controllers.CloneController import CloneController
|
||||||
|
from AnP.Controllers.AITranslateController import AITranslateController
|
||||||
|
|
||||||
|
inputs:dict[str, dict[str, Any|None]] = {
|
||||||
|
"default_models" : {
|
||||||
|
"AIController" : AIController,
|
||||||
|
"CloneController" : CloneController,
|
||||||
|
"AITranslateController" : AITranslateController,
|
||||||
|
"WebSocketServerDriver" : WebSocketServerDriver,
|
||||||
|
"HTTPSocketServerDriver" : HTTPSocketServerDriver,
|
||||||
|
"HTTPServerDriver" : HTTPServerDriver,
|
||||||
|
"OllamaDriver" : OllamaDriver,
|
||||||
|
"FilesDriver" : FilesDriver
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
from secrets import secrets as custom_secrets
|
||||||
|
|
||||||
|
for key, value in dict(custom_secrets).items():
|
||||||
|
if key not in inputs or isinstance(inputs[key], dict):
|
||||||
|
inputs[key] = value
|
||||||
|
elif isinstance(value, dict):
|
||||||
|
for subkey, subvalue in value.items():
|
||||||
|
inputs[key][subkey] = subvalue
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
@ -1,312 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Any, Callable, Self, Sequence, Optional, ClassVar
|
|
||||||
from re import Pattern as REPattern
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
class RE:
|
|
||||||
|
|
||||||
KEY:ClassVar[REPattern]
|
|
||||||
STRING_VARIABLES:ClassVar[REPattern]
|
|
||||||
SLASHES:ClassVar[REPattern]
|
|
||||||
NEW_LINES:ClassVar[REPattern]
|
|
||||||
ROUTE:ClassVar[REPattern]
|
|
||||||
TO_REGULAR_EXPRESSION:ClassVar[REPattern]
|
|
||||||
ROUTE_KEY:ClassVar[REPattern]
|
|
||||||
EXCEPTION:ClassVar[REPattern]
|
|
||||||
NEW_LINE:ClassVar[REPattern]
|
|
||||||
HTTP_VARIABLE:ClassVar[REPattern]
|
|
||||||
PARENT_PATH:ClassVar[REPattern]
|
|
||||||
DOUBLE_NEW_LINE:ClassVar[REPattern]
|
|
||||||
HTTP_HEADER_PARAMETER:ClassVar[REPattern]
|
|
||||||
HTTP_REQUEST:ClassVar[REPattern]
|
|
||||||
|
|
||||||
class Check(ABC):
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_string(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_binary(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_key(cls:type[Self], item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_array(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_dictionary(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_boolean(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_integer(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_function(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_regular_expression(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_json_string(item:Any|None, full:bool = False) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_json(item:Any|None) -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_json_data(item:Any|None, full:bool = False) -> bool:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_mark_key(cls:type[Self], key:str, marks:str|Sequence[str] = "AnP") -> bool:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def is_file(path:str) -> bool:pass
|
|
||||||
|
|
||||||
class Common(ABC):
|
|
||||||
|
|
||||||
ROOT_PATH:ClassVar[str]
|
|
||||||
SLASH:ClassVar[str]
|
|
||||||
ROOTS_PATH:ClassVar[list[str]]
|
|
||||||
SPECIAL_REGULAR_EXPRESSION_CHARACTERS:ClassVar[dict[str, str]]
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_keys(cls:type[Self], *items:list[Any|None]) -> list[str]:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_texts(cls:type[Self], *items:list[Any|None]) -> list[str]:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_dictionaries(cls:type[Self], *items:list[Any|None]) -> list[dict[str, Any|None]]:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_dictionary(cls:type[Self], inputs:Any|None, overwrite:bool = False) -> dict[str, Any|None]:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_value(cls:type[Self],
|
|
||||||
keys:str|Sequence[str],
|
|
||||||
inputs:dict[str, Any|None]|Sequence[Any|None],
|
|
||||||
default:Optional[Any|None] = None
|
|
||||||
) -> Any|None:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def string_variables(cls:type[Self],
|
|
||||||
string:str,
|
|
||||||
inputs:dict[str, Any|None]|Sequence[Any|None],
|
|
||||||
default:Optional[str] = None
|
|
||||||
) -> str:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def fix_path(cls:type[Self], path:str) -> str:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_absolute_path(cls:type[Self], path:str) -> str|None:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def load_file(cls:type[Self], path:str, mode:str = "r") -> str|bytes|None:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def load_json(cls:type[Self],
|
|
||||||
data:str|dict[str, Any|None]|Sequence[Any|None],
|
|
||||||
only_dictionaries:bool = True
|
|
||||||
) -> list[dict[str, Any|None]|Sequence[Any|None]]:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_action_data(i:int = 0) -> dict[str, str|int]:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def to_regular_expression(cls:type[Self], string:str) -> str:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def get_mime_from_path(path:str) -> str|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def json_encode(data:dict[str, Any|None]|Sequence[Any|None]) -> str|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def json_decode(data:str|bytes) -> dict[str, Any|None]|Sequence[Any|None]|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def base64_encode(data:bytes) -> str|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def base64_decode(data:str) -> bytes|None:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def data_encode(cls:type[Self], data:Any|None) -> str|None:pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def data_decode(cls:type[Self], data:str) -> Any|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def execute(callback:Callable[..., Any|None], *arguments:Any|None) -> Any|None:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def unique(items:str|Sequence[Any|None]) -> str|list[Any|None]:pass
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@abstractmethod
|
|
||||||
def random(items:str|Sequence[Any|None]) -> Any|None:pass
|
|
||||||
|
|
||||||
class AIResponseModel(ABC):
|
|
||||||
|
|
||||||
def __init__(self:Self, conversation:str) -> None:
|
|
||||||
self.conversation:str
|
|
||||||
self.start:float
|
|
||||||
self.model:str
|
|
||||||
self.response:str
|
|
||||||
self.total:str
|
|
||||||
self.context:str|list[str]
|
|
||||||
self.done:bool
|
|
||||||
self.end:float|None
|
|
||||||
self.chunks:int
|
|
||||||
self.ok:bool
|
|
||||||
self.http_code:int
|
|
||||||
self.http_message:str
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update(self:Self, data:dict[str, Any|None]) -> None:pass
|
|
||||||
|
|
||||||
class CommandModel(ABC):
|
|
||||||
|
|
||||||
def __init__(self:Self,
|
|
||||||
names:str|Sequence[str],
|
|
||||||
callback:Callable[[dict[str, Any|None], Optional[list[Any|None]]], None]
|
|
||||||
) -> None:
|
|
||||||
self.names:list[str]
|
|
||||||
self.callback:Callable[[dict[str, Any|None], Optional[list[Any|None]]], None]
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update(self:Self,
|
|
||||||
names:str|Sequence[str],
|
|
||||||
callback:Optional[Callable[[dict[str, Any|None], Optional[list[Any|None]]], None]] = None,
|
|
||||||
overwrite:bool = False
|
|
||||||
) -> None:pass
|
|
||||||
|
|
||||||
class PseudoLoRAModel(ABC):
|
|
||||||
|
|
||||||
def __init__(self:Self,
|
|
||||||
title:str,
|
|
||||||
content:str|Sequence[Any|None],
|
|
||||||
keys:Optional[str|Sequence[str]] = None,
|
|
||||||
cacheable:bool = False
|
|
||||||
) -> None:
|
|
||||||
self.title:str
|
|
||||||
self.path:str|None
|
|
||||||
self.memory:int
|
|
||||||
self.cache:str
|
|
||||||
self.i:int
|
|
||||||
self.keys:list[str]
|
|
||||||
self.cacheable:bool
|
|
||||||
self.nested:list[PseudoLoRAModel]
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def clean_cache(self:Self) -> None:pass
|
|
||||||
|
|
||||||
class QueueItemModel(ABC):
|
|
||||||
def __init__(self:Self, i:int, callback:Callable[[Callable[[], None]], None], *arguments:list[Any|None]) -> None:
|
|
||||||
self.i:int
|
|
||||||
self.callback:Callable[[Callable[[], None]], None]
|
|
||||||
self.arguments:list[Any|None]
|
|
||||||
self.executing:bool
|
|
||||||
self.thread:Thread|None
|
|
||||||
|
|
||||||
class QueuesModel(ABC):
|
|
||||||
|
|
||||||
def __init__(self:Self, key:str, inputs:Optional[int|dict[str, Any|None]|Sequence[Any|None]] = None) -> None:
|
|
||||||
self.key:str
|
|
||||||
self.items:dict[int, QueueItemModel]
|
|
||||||
self.i:int
|
|
||||||
self.p:int
|
|
||||||
self.maximum:int
|
|
||||||
self.current:int
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add(self:Self, callback:Callable[[Callable[[], None]], None], *arguments:list[Any|None]) -> int|None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def cancel(self:Self, i:int) -> bool:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def cancel_all(self:Self) -> None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def next(self:Self) -> None:pass
|
|
||||||
|
|
||||||
class RequestModel(ABC):
|
|
||||||
|
|
||||||
def __init__(self:Self, session:Optional[SessionModel] = None) -> None:
|
|
||||||
self.post_variables:dict[str, Any|None]
|
|
||||||
self.get_variables:dict[str, Any|None]
|
|
||||||
self.url_variables:dict[str, Any|None]
|
|
||||||
self.hash_variables:dict[str, Any|None]
|
|
||||||
self.cookies:dict[str, Any|None]
|
|
||||||
self.variables:dict[str, Any|None]
|
|
||||||
self.request_headers:dict[str, Any|None]
|
|
||||||
self.method:str|None
|
|
||||||
self.route:RouteAbstract|None
|
|
||||||
self.response:str|bytes|None
|
|
||||||
self.response_mime:str|None
|
|
||||||
self.response_charset:str|None
|
|
||||||
self.response_code:int
|
|
||||||
self.response_headers:dict[str, Any|None]
|
|
||||||
self.callback:Callable[[RequestModel, str|bytes|None], None]|None
|
|
||||||
self.data:Any|None
|
|
||||||
self.session:SessionModel|None
|
|
||||||
self.protocol:str|None
|
|
||||||
self.protocol_version:str|None
|
|
||||||
self.last_modified:str|None
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get(self:Self, key:str|Sequence[str], default:Optional[Any] = None) -> Any|None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def set_variables(self:Self, inputs:dict[str, Any|None], on:Optional[str] = None) -> None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def set_response(self:Self, data:Any|None) -> None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def set_request_headers(self:Self, inputs:Any|None) -> None:pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def set_response_headers(self:Self, inputs:Any|None) -> None:pass
|
|
||||||
@ -1,38 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Any
|
from AnP.Application.AnP import AnP
|
||||||
from Application.AnP import AnP
|
from base import inputs
|
||||||
from Controllers.AIController import AIController
|
|
||||||
from Drivers.WebSocketServerDriver import WebSocketServerDriver
|
|
||||||
from Drivers.HTTPSocketServerDriver import HTTPSocketServerDriver
|
|
||||||
from Drivers.HTTPServerDriver import HTTPServerDriver
|
|
||||||
from Drivers.OllamaDriver import OllamaDriver
|
|
||||||
from Drivers.FilesDriver import FilesDriver
|
|
||||||
|
|
||||||
inputs:dict[str, dict[str, Any|None]] = {
|
|
||||||
"default_models" : {
|
|
||||||
"AIController" : AIController,
|
|
||||||
"WebSocketServerDriver" : WebSocketServerDriver,
|
|
||||||
"HTTPSocketServerDriver" : HTTPSocketServerDriver,
|
|
||||||
"HTTPServerDriver" : HTTPServerDriver,
|
|
||||||
"OllamaDriver" : OllamaDriver,
|
|
||||||
"FilesDriver" : FilesDriver
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
from secrets import secrets as custom_secrets
|
|
||||||
|
|
||||||
for key, value in dict(custom_secrets).items():
|
|
||||||
if key not in inputs or isinstance(inputs[key], dict):
|
|
||||||
inputs[key] = value
|
|
||||||
elif isinstance(value, dict):
|
|
||||||
for subkey, subvalue in value.items():
|
|
||||||
inputs[key][subkey] = subvalue
|
|
||||||
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
anp:AnP = AnP(inputs)
|
anp:AnP = AnP(inputs)
|
||||||
|
|
||||||
|
anp.controllers.execute("clonations_processes", "execute", None)
|
||||||
Loading…
Reference in New Issue
Block a user