Returns normalized string representation of a given filepath >>> normalizePath('//var///log/apache.log') '/var/log/apache.log'
(filepath)
| 2110 | return retVal |
| 2111 | |
| 2112 | def normalizePath(filepath): |
| 2113 | """ |
| 2114 | Returns normalized string representation of a given filepath |
| 2115 | |
| 2116 | >>> normalizePath('//var///log/apache.log') |
| 2117 | '/var/log/apache.log' |
| 2118 | """ |
| 2119 | |
| 2120 | retVal = filepath |
| 2121 | |
| 2122 | if retVal: |
| 2123 | retVal = retVal.strip("\r\n") |
| 2124 | retVal = ntpath.normpath(retVal) if isWindowsDriveLetterPath(retVal) else re.sub(r"\A/{2,}", "/", posixpath.normpath(retVal)) |
| 2125 | |
| 2126 | return retVal |
| 2127 | |
| 2128 | def safeFilepathEncode(filepath): |
| 2129 | """ |
no test coverage detected
searching dependent graphs…