
    Rtfq                     B    d Z ddlZddlZddlmZ ddlmZ dee   fdZy)z'Utility functions for pre-commit hooks.    N)Path)Sequencesrcsc           
         | st        d      j                         dfS t        t        j                  j	                  | D cg c])  }t        |      j                         j                         + c}            }t        j                  |g|j                        D ]`  }|dz  j                         r|dfc S |dz  j                         r|dfc S |dz  j                         s|dz  j                         s\|dfc S  dfS c c}w )	a  
    Return a directory containing .git, .hg, pyproject.toml, or setup.cfg.

    That directory can be one of the directories passed in ``srcs`` or their
    common parent. If no directory in the tree contains a marker that would
    specify it's the project root, the root of the file system is returned.

    Parameters
    ----------
    srcs : Sequence[str]
        The filepaths to run the hook on.

    Returns
    -------
    str
        The project root directory.

    See Also
    --------
    black.find_project_root :
        This function was adapted from
        `Black <https://github.com/psf/black/blob/main/src/black/files.py>`_.
    .zcurrent directoryzpyproject.tomlz	setup.cfgz.gitz.hgzversion controlzfile system root)r   resolveospath
commonpath
expanduser	itertoolschainparentsis_fileexistsis_dir)r   srccommon_pathdirs       6/usr/lib/python3/dist-packages/numpydoc/hooks/utils.pyfind_project_rootr   	   s    0 Cy  "$777
MDI002::<MNK }k.A.AB *""++-(((+&&(##&L  "sU{&:&:&<)))* """ Ns    .D)	__doc__r   r	   pathlibr   typingr   strr        r   <module>r      s$    -  	  '#HSM '#r   