How to use wslpy - 10 common examples

To help you get started, we’ve selected a few wslpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wslutilities / wslpy / wslpy / convert.py View on Github external
if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:', input) is not None:  # Windows Path
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.WIN:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(input)
        else:
            raise ValueError("Invalid Conversion Type "+toType)
    else:
        raise ValueError("Invalid Path "+input)
github wslutilities / wslpy / wslpy / convert.py View on Github external
def to(input, toType=PathConvType.AUTO):
    """
    Convert between 3 types of path used widely in WSL.

    Parameters
    ----------
    input : str
        the string of the original path.
    toType : PathConvType
        the type user wants to convert to. Default is PathConvType.AUTO.

    Returns
    -------
    string of converted path.

    Raises
    ------
github wslutilities / wslpy / wslpy / convert.py View on Github external
Returns
    -------
    string of converted path.

    Raises
    ------
    ValueError
        An error occurred when the input is invalid.
    """
    if re.match(r'\/mnt\/[A-Za-z]', input) is not None:  # Linux Path
        if toType == PathConvType.AUTO:
            return __Lin2Win__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(input)
        elif toType == PathConvType.LINUX:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(__Lin2Win__(input))
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:\\\\', input) is not None:  # Windows Path /w Double Dashline
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
github wslutilities / wslpy / wslpy / convert.py View on Github external
elif toType == PathConvType.WIN:
            return __Lin2Win__(input)
        elif toType == PathConvType.LINUX:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(__Lin2Win__(input))
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:\\\\', input) is not None:  # Windows Path /w Double Dashline
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:', input) is not None:  # Windows Path
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.WIN:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(input)
        else:
            raise ValueError("Invalid Conversion Type "+toType)
    else:
        raise ValueError("Invalid Path "+input)
github wslutilities / wslpy / wslpy / convert.py View on Github external
ValueError
        An error occurred when the input is invalid.
    """
    if re.match(r'\/mnt\/[A-Za-z]', input) is not None:  # Linux Path
        if toType == PathConvType.AUTO:
            return __Lin2Win__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(input)
        elif toType == PathConvType.LINUX:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(__Lin2Win__(input))
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:\\\\', input) is not None:  # Windows Path /w Double Dashline
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:', input) is not None:  # Windows Path
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.WIN:
            return input
github wslutilities / wslpy / wslpy / convert.py View on Github external
Parameters
    ----------
    input : str
        the string of the original path.

    Returns
    -------
    string of Linux Style path.

    Raises
    ------
    ValueError
        An error occurred when the input is invalid.
    """
    return to(input, PathConvType.LINUX)
github wslutilities / wslpy / wslpy / convert.py View on Github external
"""
    if re.match(r'\/mnt\/[A-Za-z]', input) is not None:  # Linux Path
        if toType == PathConvType.AUTO:
            return __Lin2Win__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(input)
        elif toType == PathConvType.LINUX:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(__Lin2Win__(input))
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:\\\\', input) is not None:  # Windows Path /w Double Dashline
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:', input) is not None:  # Windows Path
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.WIN:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(input)
github wslutilities / wslpy / wslpy / convert.py View on Github external
if toType == PathConvType.AUTO:
            return __Lin2Win__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(input)
        elif toType == PathConvType.LINUX:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(__Lin2Win__(input))
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:\\\\', input) is not None:  # Windows Path /w Double Dashline
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(input)
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(input)
        elif toType == PathConvType.WIN:
            return __Lin2Win__(__DWin2Lin__(input))
        elif toType == PathConvType.WINDOUBLE:
            return input
        else:
            raise ValueError("ERROR: Invalid Conversion Type "+toType)
    elif re.match(r'[A-Za-z]:', input) is not None:  # Windows Path
        if toType == PathConvType.AUTO:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.LINUX:
            return __DWin2Lin__(__Win2Dwin__(input))
        elif toType == PathConvType.WIN:
            return input
        elif toType == PathConvType.WINDOUBLE:
            return __Win2Dwin__(input)
        else:
            raise ValueError("Invalid Conversion Type "+toType)
github wslutilities / wslpy / wslpy / convert.py View on Github external
Parameters
    ----------
    input : str
        the string of the original path.

    Returns
    -------
    string of Windows Style path.

    Raises
    ------
    ValueError
        An error occurred when the input is invalid.
    """
    return to(input, PathConvType.WIN)
github wslutilities / wslpy / wslpy / convert.py View on Github external
Parameters
    ----------
    input : str
        the string of the original path.

    Returns
    -------
    string of Windows Path /w Double Style path.

    Raises
    ------
    ValueError
        An error occurred when the input is invalid.
    """
    return to(input, PathConvType.WINDOUBLE)

wslpy

Python Library for WSL specific tasks

GPL-3.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis