o
    pf                     @   s0   z	d dl mZ W dS  ey   dd ZY dS w )    )
commonpathc           	         s   | st dt| } t| d trdd ndd fdd| D }ztfd	d
| D \}W n t y<   t dw  fdd|D }t|}t|}|}t|D ]\}}||| krf|d| } nqT|rkndd }|| S )zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencer      /   ./.c                    s   g | ]}|  qS  )split).0pathsepr   G/home/ertert/spirit/venv/lib/python3.10/site-packages/fs/_pathcompat.py
<listcomp>   s    zcommonpath.<locals>.<listcomp>c                 3   s     | ]}|d d  kV  qd S )N   r   )r	   pr   r   r   	<genexpr>   s    zcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsc                    s   g | ]} fd d|D qS )c                    s   g | ]
}|r| kr|qS r   r   )r	   ccurdirr   r   r      s    z)commonpath.<locals>.<listcomp>.<listcomp>r   )r	   sr   r   r   r      s    N)	
ValueErrortuple
isinstancebytessetminmax	enumeratejoin)	pathssplit_pathsisabss1s2commonir   prefixr   )r   r   r   r   
   s2   r   N)os.pathr   ImportErrorr   r   r   r   <module>   s
   