#####################################################################
# DOC #
#####################################################################
"""
@author: F. Ramognino <federico.ramognino@polimi.it>
Last update: 12/06/2023
"""
#####################################################################
# IMPORT #
#####################################################################
from typing import Self
from .Functions.typeChecking import checkType, checkArray, checkMap
from .Functions.runtimeWarning import runtimeWarning, runtimeError, printStack
import numpy as np
import copy as cp
import os
#############################################################################
# MAIN CLASSES #
#############################################################################
[docs]
class Utilities(object):
"""
Class wrapping useful methods (virtual).
"""
#Type checking:
[docs]
@staticmethod
def checkType(*args, **argv):
return checkType(*args, **argv)
[docs]
@staticmethod
def checkArray(*args, **argv):
return checkArray(*args, **argv)
[docs]
@staticmethod
def checkMap(*args, **argv):
return checkMap(*args, **argv)
#Errors
[docs]
@staticmethod
def runtimeError(*args, **argv):
return runtimeError(*args, **argv)
[docs]
@staticmethod
def runtimeWarning(*args, **argv):
return runtimeWarning(*args, **argv)
[docs]
@staticmethod
def printStack(*args, **argv):
return printStack(*args, **argv)
#Copy
[docs]
def copy(self) -> Self:
"""
Wrapper of copy.deepcopy function.
"""
return cp.deepcopy(self)
#Useful packages:
np = np
cp = cp
os = os
##########################################################################################
#Return empty instance of the class:
[docs]
@classmethod
def empty(cls):
"""
Return an empty instance of class.
"""
out = cls.__new__(cls)
return out