<reponame>boeddeker/graphviz
"""Mixin classes used by Base subclasses to inherit backend functionality."""

from .. import parameters

from . import piping
from . import rendering
from . import unflattening
from . import viewing

__all__ = ['Render', 'Pipe', 'Unflatten', 'View']


class Render(parameters.Parameters):
    """Parameters for calling and calling ``graphviz.render()``."""

    def _get_render_parameters(self, **kwargs):
        kwargs = self._get_parameters(**kwargs)
        return [kwargs.pop('engine'), kwargs.pop('format')], kwargs

    @property
    def _render(_):
        """Simplify ``._render()`` mocking."""
        return rendering.render


class Pipe(parameters.Parameters):
    """Parameters for calling and calling ``graphviz.pipe()``."""

    def _get_pipe_parameters(self, **kwargs):
        kwargs = self._get_parameters(**kwargs)
        return [kwargs.pop('engine'), kwargs.pop('format')], kwargs

    @property
    def _pipe_lines(_):
        """Simplify ``._pipe_lines()`` mocking."""
        return piping.pipe_lines

    @property
    def _pipe_lines_string(_):
        """Simplify ``._pipe_lines_string()`` mocking."""
        return piping.pipe_lines_string


class Unflatten:

    @property
    def _unflatten(_):
        """Simplify ``._unflatten mocking."""
        return unflattening.unflatten


class View:
    """Open filepath with its default viewing application
        (platform-specific)."""

    _view_darwin = staticmethod(viewing.view_darwin)

    _view_freebsd = staticmethod(viewing.view_unixoid)

    _view_linux = staticmethod(viewing.view_unixoid)

    _view_windows = staticmethod(viewing.view_windows)

"""Mixin classes used by Base subclasses to inherit backend functionality."""

from .. import parameters

from . import piping
from . import rendering
from . import unflattening
from . import viewing

__all__ = ['Render', 'Pipe', 'Unflatten', 'View']


class Render(parameters.Parameters):
    """Parameters for calling and calling ``graphviz.render()``."""

    def _get_render_parameters(self, **kwargs):
        kwargs = self._get_parameters(**kwargs)
        return [kwargs.pop('engine'), kwargs.pop('format')], kwargs

    @property
    def _render(_):
        """Simplify ``._render()`` mocking."""
        return rendering.render


class Pipe(parameters.Parameters):
    """Parameters for calling and calling ``graphviz.pipe()``."""

    def _get_pipe_parameters(self, **kwargs):
        kwargs = self._get_parameters(**kwargs)
        return [kwargs.pop('engine'), kwargs.pop('format')], kwargs

    @property
    def _pipe_lines(_):
        """Simplify ``._pipe_lines()`` mocking."""
        return piping.pipe_lines

    @property
    def _pipe_lines_string(_):
        """Simplify ``._pipe_lines_string()`` mocking."""
        return piping.pipe_lines_string


class Unflatten:

    @property
    def _unflatten(_):
        """Simplify ``._unflatten mocking."""
        return unflattening.unflatten


class View:
    """Open filepath with its default viewing application
        (platform-specific)."""

    _view_darwin = staticmethod(viewing.view_darwin)

    _view_freebsd = staticmethod(viewing.view_unixoid)

    _view_linux = staticmethod(viewing.view_unixoid)

    _view_windows = staticmethod(viewing.view_windows)
Mixin classes used by Base subclasses to inherit backend functionality. Parameters for calling and calling ``graphviz.render()``. Simplify ``._render()`` mocking. Parameters for calling and calling ``graphviz.pipe()``. Simplify ``._pipe_lines()`` mocking. Simplify ``._pipe_lines_string()`` mocking. Simplify ``._unflatten mocking. Open filepath with its default viewing application         (platform-specific).