Patch for a Python Issue18171 (http://bugs.python.org/issue18171) >>> os.path.basename(__file__) in safeExpandUser(__file__) True
(filepath)
| 2142 | |
| 2143 | |
| 2144 | def safeExpandUser(filepath): |
| 2145 | """ |
| 2146 | Patch for a Python Issue18171 (http://bugs.python.org/issue18171) |
| 2147 | |
| 2148 | >>> os.path.basename(__file__) in safeExpandUser(__file__) |
| 2149 | True |
| 2150 | """ |
| 2151 | |
| 2152 | retVal = filepath |
| 2153 | |
| 2154 | try: |
| 2155 | retVal = os.path.expanduser(filepath) |
| 2156 | except UnicodeError: |
| 2157 | _ = locale.getdefaultlocale() |
| 2158 | encoding = _[1] if _ and len(_) > 1 else UNICODE_ENCODING |
| 2159 | retVal = getUnicode(os.path.expanduser(filepath.encode(encoding)), encoding=encoding) |
| 2160 | |
| 2161 | return retVal |
| 2162 | |
| 2163 | def safeStringFormat(format_, params): |
| 2164 | """ |
no test coverage detected
searching dependent graphs…