Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
py311.py23 linesDownload Raw Back to compat
1import os2import pathlib3import sys4import types5 6 7def wrap(path):  # pragma: no cover8    """9    Workaround for https://github.com/python/cpython/issues/8453810    to add backward compatibility for walk_up=True.11    An example affected package is dask-labextension, which uses12    jupyter-packaging to install JupyterLab javascript files outside13    of site-packages.14    """15 16    def relative_to(root, *, walk_up=False):17        return pathlib.Path(os.path.relpath(path, root))18 19    return types.SimpleNamespace(relative_to=relative_to)20 21 22relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x23 
codekingpro/portable-devtools · Team Ai