Ejemplo n.º 1
0
    def __init__(self,
                 session_properties=None,
                 templates=None,
                 template_context=None,
                 default_format_opts=None,
                 **kwargs):
        """
        session_properties (dict): A mapping of default session properties
            to values. Interpretation is left up to implementations.
        templates (dict): A dictionary of name to template mappings. Additional
            templates can be added using `.template_add`.
        template_context (dict): The default template context to use when
            rendering templates.
        default_format_opts (dict): The default formatting options passed to
            cursor formatter.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)

        self.session_properties = session_properties or {}
        self._templates = templates or {}
        self._template_context = template_context or {}
        self._sqlalchemy_engine = None
        self._sqlalchemy_metadata = None
        self._default_format_opts = default_format_opts or {}

        self._init(**kwargs)
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     '''
     This is a shim __init__ function that passes all arguments onto
     `self._init`, which is implemented by subclasses. This allows subclasses
     to instantiate themselves with arbitrary parameters.
     '''
     Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)
     self._init(*args, **kwargs)
Ejemplo n.º 3
0
 def __init__(self, **kwargs):
     """
     This is a shim __init__ function that passes all arguments onto
     `self._init`, which is implemented by subclasses. This allows subclasses
     to instantiate themselves with arbitrary parameters.
     """
     Duct.__init_with_kwargs__(self, kwargs)
     self._init(**kwargs)
Ejemplo n.º 4
0
 def __init__(self, cwd=None, global_writes=False, **kwargs):
     """
     This is a shim __init__ function that passes all arguments onto
     `self._init`, which is implemented by subclasses. This allows subclasses
     to instantiate themselves with arbitrary parameters.
     """
     Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)
     self._path_cwd = cwd
     self.__path_home = None
     self.global_writes = global_writes
     self._init(**kwargs)
Ejemplo n.º 5
0
 def __init__(self, cwd=None, global_writes=False, **kwargs):
     """
     This is a shim __init__ function that passes all arguments onto
     `self._init`, which is implemented by subclasses. This allows subclasses
     to instantiate themselves with arbitrary parameters.
     """
     Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)
     self._path_cwd = cwd
     self.__path_home = None
     self.global_writes = global_writes
     self._init(**kwargs)
Ejemplo n.º 6
0
 def __init__(self, cwd=None, global_writes=False, **kwargs):
     """
     cwd (None, str): The path prefix to use as the current working directory
         (if None, the user's home directory is used where that makes sense).
     global_writes (bool): Whether to allow writes outside of the user's home
         folder.
     **kwargs (dict): Additional keyword arguments to passed on to subclasses.
     """
     Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)
     self._path_cwd = cwd
     self.__path_home = None
     self.global_writes = global_writes
     self._init(**kwargs)
Ejemplo n.º 7
0
    def __init__(self, server_protocol='http', assume_json=False, endpoint_prefix='', **kwargs):
        """
        This is a shim __init__ function that passes all arguments onto
        `self._init`, which is implemented by subclasses. This allows subclasses
        to instantiate themselves with arbitrary parameters.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=80)

        self.server_protocol = server_protocol
        self.assume_json = assume_json
        self.endpoint_prefix = endpoint_prefix

        self._init(**kwargs)
Ejemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        '''
        This is a shim __init__ function that passes all arguments onto
        `self._init`, which is implemented by subclasses. This allows subclasses
        to instantiate themselves with arbitrary parameters.
        '''
        Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)

        self._templates = kwargs.pop('templates', {})
        self._template_context = kwargs.pop('template_context', {})
        self._sqlalchemy_engine = None
        self._sqlalchemy_metadata = None

        self._init(*args, **kwargs)
Ejemplo n.º 9
0
    def __init__(self, **kwargs):
        """
        templates (dict): A dictionary of name to template mappings. Additional
            templates can be added using `.template_add`.
        template_context (dict): The default template context to use when
            rendering templates.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)

        self._templates = kwargs.pop('templates', {})
        self._template_context = kwargs.pop('template_context', {})
        self._sqlalchemy_engine = None
        self._sqlalchemy_metadata = None

        self._init(**kwargs)
Ejemplo n.º 10
0
    def __init__(self,
                 server_protocol='http',
                 assume_json=False,
                 endpoint_prefix='',
                 **kwargs):
        """
        This is a shim __init__ function that passes all arguments onto
        `self._init`, which is implemented by subclasses. This allows subclasses
        to instantiate themselves with arbitrary parameters.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=80)

        self.server_protocol = server_protocol
        self.assume_json = assume_json
        self.endpoint_prefix = endpoint_prefix

        self._init(**kwargs)
Ejemplo n.º 11
0
    def __init__(self, session_properties=None, templates=None, template_context=None, **kwargs):
        """
        session_properties (dict): A mapping of default session properties
            to values. Interpretation is left up to implementations.
        templates (dict): A dictionary of name to template mappings. Additional
            templates can be added using `.template_add`.
        template_context (dict): The default template context to use when
            rendering templates.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)

        self.session_properties = session_properties or {}
        self._templates = templates or {}
        self._template_context = template_context or {}
        self._sqlalchemy_engine = None
        self._sqlalchemy_metadata = None

        self._init(**kwargs)
Ejemplo n.º 12
0
    def __init__(self,
                 server_protocol='http',
                 assume_json=False,
                 endpoint_prefix='',
                 **kwargs):
        """
        Args:
            server_protocol (str): The protocol to use when connecting to the
                remote host (default: `'http'`).
            assume_json (bool): Assume that responses will be JSON when calling
                instances of this class (default: `False`).
            endpoint_prefix (str): The base_url path relative to the host at
                which the API is accessible (default: `''`).
            **kwargs (dict): Additional keyword arguments passed on to
                subclasses.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=80)

        self.server_protocol = server_protocol
        self.assume_json = assume_json
        self.endpoint_prefix = endpoint_prefix

        self._init(**kwargs)
Ejemplo n.º 13
0
 def __init__(self,
              cwd=None,
              home=None,
              read_only=False,
              global_writes=False,
              **kwargs):
     """
     cwd (None, str): The path prefix to use as the current working directory
         (if None, the user's home directory is used where that makes sense).
     home (None, str): The path prefix to use as the current users' home
         directory. If not specified, it will default to an implementation-
         specific value (often '/').
     read_only (bool): Whether the filesystem should only be able to perform
         read operations.
     global_writes (bool): Whether to allow writes outside of the user's home
         folder.
     **kwargs (dict): Additional keyword arguments to passed on to subclasses.
     """
     Duct.__init_with_kwargs__(self, kwargs, port=self.DEFAULT_PORT)
     self._path_cwd = cwd
     self.__path_home = home
     self.read_only = read_only
     self.global_writes = global_writes
     self._init(**kwargs)
Ejemplo n.º 14
0
    def __init__(self, smartcards=None, **kwargs):
        """
        Create a new SSHClient.

        Parameters
        ----------
        host : string
            Remote host for ssh.
        user : string
            User name for ssh.
        kwargs : dict
            Extra parameters passed on to SSHClient._init, as implemented by subclasses.

        Returns
        -------
        self : SSHClient
            An SSHClient object with the connection details specified.
        """
        Duct.__init_with_kwargs__(self, kwargs, port=22)

        self.smartcards = smartcards
        self.__port_forwarding_register = PortForwardingRegister()

        self._init(**kwargs)
Ejemplo n.º 15
0
 def __init__(self, **kwargs):
     Duct.__init_with_kwargs__(self, kwargs)
     self._init(**kwargs)
Ejemplo n.º 16
0
 def __init__(self, **kwargs):
     Duct.__init_with_kwargs__(self, kwargs)
     self._init(**kwargs)