Example #1
0
 def __init__(self, client: LbClient):
     '''
     constructor
     :param client: the LbClient instance to handle
     '''
     QRunnable.__init__(self)
     self.client = client
    def __init__(self,
                 grid: MultiCircuit,
                 options: ShortCircuitOptions,
                 pf_options: PowerFlowOptions,
                 pf_results: PowerFlowResults,
                 opf_results=None):
        """
        PowerFlowDriver class constructor
        @param grid: MultiCircuit Object
        """
        QRunnable.__init__(self)

        # Grid to run a power flow in
        self.grid = grid

        # power flow results
        self.pf_results = pf_results

        self.pf_options = pf_options

        self.opf_results = opf_results

        # Options to use
        self.options = options

        self.results = None

        self.logger = Logger()

        self.__cancel__ = False
Example #3
0
 def __init__(self, ip, port, timeout=1):
     QRunnable.__init__(self)
     self.ip = ip
     self.port = port
     self.done = -1
     self.timeout = timeout
     self.connector = MySignals()
Example #4
0
    def __init__(self, circuit: MultiCircuit):
        """
        Constructor
        :param circuit: circuit object
        """

        QRunnable.__init__(self)

        self.grid = circuit

        self.se_results = None
Example #5
0
    def __init__(self,
                 func,
                 args: list = None,
                 logger: logging.Logger = None,
                 parent: QObject = None):
        QObject.__init__(self, parent=parent)
        QRunnable.__init__(self)

        self.logger = logger
        self.func = func
        if args is None:
            self.args = []
        else:
            self.args = args
        self.name = func.__name__
Example #6
0
    def __init__(self, func: Callable[[List[Any]], Optional[int]], args: List[Any] = None,
                 logger: logging.Logger = None, parent: QObject = None):
        """
        Args:
            func: function to run. It should return 0 or None for the call to be considered successful
            args: the list of positional arguments. They will be unpacked and passed to the function
            logger: optional logger to report about the occurred exception
            parent: Qt object
        """
        QObject.__init__(self, parent=parent)
        QRunnable.__init__(self)

        self.func = func
        self.args = args if args is not None else []
        self.logger = logger
        self.name = func.__name__
Example #7
0
    def __init__(self, grid: MultiCircuit):
        """
        PowerFlowDriver class constructor
        @param grid: MultiCircuit Object
        """
        QRunnable.__init__(self)

        # Grid to run a power flow in
        self.grid = grid

        # Options to use
        self.options = options

        self.results = None

        self.__cancel__ = False
Example #8
0
    def __init__(self, grid: MultiCircuit, options: OptimalPowerFlowOptions):
        """
        PowerFlow class constructor
        @param grid: MultiCircuit Object
        @param options: OPF options
        """
        QRunnable.__init__(self)

        # Grid to run a power flow in
        self.grid = grid

        # Options to use
        self.options = options

        # OPF results
        self.results = None

        # set cancel state
        self.__cancel__ = False

        self.all_solved = True
Example #9
0
    def __init__(self,
                 conn: sqlite3.Connection,
                 function: Callable = None,
                 query_number: int = 0):
        """Init a runnable with connection and callable

        Notes:
            Since sqlite3 Connection objects are not thread safe, we create a new
            connection based on it.

        Examples:

            >>> runnable = SqlRunnable(conn, lambda conn : conn.execute("query"))
            >>> def my_func(conn):
            ...     return conn.execute("query")
            >>> runnable = SqlRunnable(conn, my_func)

        Args:
            conn (sqlite3.Connection): sqlite3 Connexion
            function (Callable): Function that can takes conn in its first argument.
                This function will be executed in a separated thread.
        """
        # Must instantiate the 2 constructors, especially QObject for Signals
        # Workaround for:
        # AttributeError: 'PySide2.QtCore.Signal' object has no attribute 'connect'
        QObject.__init__(self)
        QRunnable.__init__(self)

        self._function = None
        if function:
            self.function = function

        # Get the database filename to duplicate the connection to be thread safe
        self.db_file = conn.execute("PRAGMA database_list").fetchone()["file"]
        self.async_conn = None

        self.results = None
        self.query_number = query_number
        self.setAutoDelete(False)
Example #10
0
 def __init__(self, widget):
     QRunnable.__init__(self)
     self.widget = widget
     self.computer = widget.computer
     self.connector = LbClient.StatusThreadSignal()
 def __init__(self, func, *args, parent=None):
     QRunnable.__init__(self)
     QObject.__init__(self, parent)
     self.__func = func
     self.__args = args
Example #12
0
 def __init__(self, func, *args, **kwargs):
     self.func = func
     self.args = args
     self.kwargs = kwargs
     QRunnable.__init__(self)
Example #13
0
 def __init__(self, widget):
     QRunnable.__init__(self)
     self.widget = widget
Example #14
0
 def __init__(self, file, fn):
     QRunnable.__init__(self)
     keras.callbacks.Callback.__init__(self)
     self.fn = fn
     self.file = file
     self.signals = WorkerSignals()
Example #15
0
 def __init__(self, func, *args, **kwargs):
     QRunnable.__init__(self)
     self._func = func
     self._args = args
     self._kwargs = kwargs
Example #16
0
 def __init__(self, path):
     QRunnable.__init__(self)
     FileAnalyzer.__init__(self)
     self.path = path
     self.signals = self.Signals()
Example #17
0
 def __init__(self, parentApp, client: Computer):
     QRunnable.__init__(self)
     self.terminalDialog = EcManRemoteTerminal(parent=parentApp,
                                               client=client)
     self.terminalDialog.setModal(False)
Example #18
0
 def __init__(self, func: Callable, callback: Callable, *func_args,
              **func_kwargs):
     QRunnable.__init__(self)
     QObject.__init__(self)
     self.callable = partial(func, *func_args, **func_kwargs)
     self.callback = partial(callback)
Example #19
0
 def __init__(self, update: Callable, state: State):
     QRunnable.__init__(self)
     self.update = update
     self.window = state.window
     self.state = state
     self.setAutoDelete(False)
Example #20
0
 def __init__(self, fixedUpdate, state):
     QRunnable.__init__(self)
     self.fixedUpdate = fixedUpdate
     self.window = state.window
     self.state = state
     self.setAutoDelete(False)