Conditions | 2 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.0932 |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
35 | 5 | def where_which(path): |
|
36 | """ |
||
37 | Backwards compatibility wrapper for approximating which/where. |
||
38 | |||
39 | :param path: Path to a file. |
||
40 | :type path: str |
||
41 | """ |
||
42 | 5 | try: |
|
43 | 5 | from shutil import which |
|
44 | except ImportError: # 3.2 |
||
45 | from shutilwhich import which |
||
46 | finally: |
||
47 | 5 | thepath = which(path) |
|
48 | return thepath |
||
49 |
It is generally a bad practice to shadow variables from the outer-scope. In most cases, this is done unintentionally and might lead to unexpected behavior: