o
    ooi                     @   s   d Z ddlZddlZddlZddlZddlZddlmZ dgZe	 
 ZeeZejdd	dd	ejejef d
eddfddZeedd	ejejef d
eddfddZeedeedd	ejejef d
eddfddZeedd	ejejef d
eddfddZdS )z<Open files in platform-specific default viewing application.    N   )_toolsview   )supported_numberFfilepathquietreturnc                 C   s>   zt tt}W n ty   tdtdw || |d dS )a  Open filepath with its default viewing application (platform-specific).

    Args:
        filepath: Path to the file to open in viewer.
        quiet: Suppress ``stderr`` output
            from the viewer process (ineffective on Windows).

    Raises:
        RuntimeError: If the current platform is not supported.

    Note:
        There is no option to wait for the application to close,
        and no way to retrieve the application's exit status.
    z	platform z not supported)r   N)getattrr   PLATFORMAttributeErrorRuntimeError)r   r   	view_func r   L/home/ubuntu/.local/lib/python3.10/site-packages/graphviz/backend/viewing.pyr      s   darwinc                C   <   d| g}t d| |rdtjini }tj|fi | dS )z1Open filepath with its default application (mac).openview: %rstderrNlogdebug
subprocessDEVNULLPopenr   r   cmdkwargsr   r   r   view_darwin+   s   r   linuxfreebsdc                C   r   )zCOpen filepath in the user's preferred application (linux, freebsd).zxdg-openr   r   Nr   r   r   r   r   view_unixoid5   s   r"   windowsc                C   s&   t j| } td|  t |  dS )z9Start filepath with its associated application (windows).r   N)ospathnormpathr   r   	startfile)r   r   r   r   r   view_windows@   s   r(   )F)__doc__loggingr$   platformr   typing r   __all__systemlowerr   	getLogger__name__r   deprecate_positional_argsUnionPathLikestrboolr   attachr   r"   r(   r   r   r   r   <module>   sH    



	

	