| Conditions | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 10 | def add_current_dir_to_syspath(f): |
||
| 11 | |||
| 12 | @wraps(f) |
||
| 13 | def wrapper(*args, **kwargs): |
||
| 14 | current = os.getcwd() |
||
| 15 | changed = False |
||
| 16 | if current not in sys.path: |
||
| 17 | sys.path.append(current) |
||
| 18 | changed = True |
||
| 19 | |||
| 20 | try: |
||
| 21 | return f(*args, **kwargs) |
||
| 22 | finally: |
||
| 23 | # restore sys.path |
||
| 24 | if changed is True: |
||
| 25 | sys.path.remove(current) |
||
| 26 | |||
| 27 | return wrapper |
||
| 28 | |||
| 47 |