| Conditions | 6 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 1 |
| CRAP Score | 34.317 |
| 1 | """Code for supporting compatibility across python versions.""" |
||
| 11 | 3 | def find_module(fullname, path): |
|
| 12 | """Compatibility wrapper for imp.find_module. |
||
| 13 | |||
| 14 | Automatically decodes arguments of find_module, in Python3 |
||
| 15 | they must be Unicode |
||
| 16 | """ |
||
| 17 | if isinstance(fullname, bytes): |
||
| 18 | fullname = fullname.decode() |
||
| 19 | if isinstance(path, bytes): |
||
| 20 | path = path.decode() |
||
| 21 | elif isinstance(path, list): |
||
| 22 | newpath = [] |
||
| 23 | for element in path: |
||
| 24 | if isinstance(element, bytes): |
||
| 25 | newpath.append(element.decode()) |
||
| 26 | else: |
||
| 27 | newpath.append(element) |
||
| 28 | path = newpath |
||
| 29 | return original_find_module(fullname, path) |
||
| 30 | |||
| 39 |