U
    d/e                     @   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ejejef edd	d
dZeedejejef edd	ddZeedeedejejef edd	ddZeedejejef edd	ddZdS )z<Open files in platform-specific default viewing application.    N   )_toolsview   )Zsupported_numberF)filepathquietreturnc                 C   sD   zt tt}W n$ tk
r2   tdtdY nX || |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   Z	view_func r   </tmp/pip-unpacked-wheel-n8ok7rre/graphviz/backend/viewing.pyr      s
    darwinc                C   s8   d| g}t d| |r"dtjini }tj|f| 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   linuxZfreebsdc                C   s8   d| g}t d| |r"dtjini }tj|f| dS )zCOpen filepath in the user's preferred application (linux, freebsd).zxdg-openr   r   Nr   r   r   r   r   view_unixoid5   s    r   Zwindowsc                C   s&   t j| } td|  t |  dS )z9Start filepath with its associated application (windows).r   N)ospathnormpathr   r   Z	startfile)r   r   r   r   r   view_windows@   s    r"   )F)__doc__loggingr   platformr   typing r   __all__systemlowerr
   	getLogger__name__r   Zdeprecate_positional_argsUnionPathLikestrboolr   attachr   r   r"   r   r   r   r   <module>   s>   

  
 	

 	
 