Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)