| Conditions | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | #!/usr/bin/python |
||
| 42 | 1 | @staticmethod |
|
| 43 | 1 | def move_to_category(filename, category, base_directory=os.getcwd()): |
|
| 44 | """Move file to the sub_category folder |
||
| 45 | |||
| 46 | :type base_directory: str |
||
| 47 | :type filename: str |
||
| 48 | :type category: str |
||
| 49 | :return: |
||
| 50 | """ |
||
| 51 | 1 | folder = re.sub(r'["/?*:<>|]', r'', html.unescape(category)) |
|
| 52 | 1 | folder = os.path.join(base_directory, folder) |
|
| 53 | 1 | folder = os.path.abspath(FileHandler.unicode_translate(folder, "\n\t\r", " ")) |
|
| 54 | 1 | if not os.path.exists(folder): |
|
| 55 | 1 | os.makedirs(folder) |
|
| 56 | move(os.path.join(base_directory, filename), os.path.join(folder, filename)) |
||
| 57 |