Module geode.lib.launcher

Expand source code
# ------------------------------------------------------------------------------
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
# ------------------------------------------------------------------------------

# Geode
from geode.lib.common import CommonObject


# ------------------------------------------------------------------------------
#   Class
# ------------------------------------------------------------------------------

class Launcher(CommonObject):

    def __init__(self, path, **kwargs):
        """ Constructor

        Parameters
        ----------
        path : str or pathlib.Path
            File instance path
        parameters: list, optional
            Launcher default parameters

        Raises
        ------
        OSError, 21
            when specified path is not a file
        """

        CommonObject.__init__(self, path, **kwargs)

        if self.path.is_dir():
            raise IsADirectoryError(
                f"Specified path '{self.path}' is a directory")

        self.parameters = kwargs.get("parameters")

    @property
    def parameters(self):
        """ Retrieve parameters list

        Returns
        -------
        list
            Parameters string list
        """

        return self.__parameters

    @parameters.setter
    def parameters(self, parameters):
        """ Set parameters list for launch command

        Parameters
        ----------
        parameters : list
            Parameters list

        Raises
        ------
        TypeError
            When the specified parameters type is not a list.
        """

        if parameters is not None and not isinstance(parameters, list):
            raise TypeError(f"Parameters needs to be a list, "
                            f"not a {type(row).__name__}")

        if parameters is None:
            parameters = list()

        self.__parameters = parameters

Classes

class Launcher (path, **kwargs)

Constructor

Parameters

path : str or pathlib.Path
File instance path
parameters : list, optional
Launcher default parameters

Raises

OSError, 21
when specified path is not a file
Expand source code
class Launcher(CommonObject):

    def __init__(self, path, **kwargs):
        """ Constructor

        Parameters
        ----------
        path : str or pathlib.Path
            File instance path
        parameters: list, optional
            Launcher default parameters

        Raises
        ------
        OSError, 21
            when specified path is not a file
        """

        CommonObject.__init__(self, path, **kwargs)

        if self.path.is_dir():
            raise IsADirectoryError(
                f"Specified path '{self.path}' is a directory")

        self.parameters = kwargs.get("parameters")

    @property
    def parameters(self):
        """ Retrieve parameters list

        Returns
        -------
        list
            Parameters string list
        """

        return self.__parameters

    @parameters.setter
    def parameters(self, parameters):
        """ Set parameters list for launch command

        Parameters
        ----------
        parameters : list
            Parameters list

        Raises
        ------
        TypeError
            When the specified parameters type is not a list.
        """

        if parameters is not None and not isinstance(parameters, list):
            raise TypeError(f"Parameters needs to be a list, "
                            f"not a {type(row).__name__}")

        if parameters is None:
            parameters = list()

        self.__parameters = parameters

Ancestors

Instance variables

var parameters

Retrieve parameters list

Returns

list
Parameters string list
Expand source code
@property
def parameters(self):
    """ Retrieve parameters list

    Returns
    -------
    list
        Parameters string list
    """

    return self.__parameters

Inherited members