diff options
| -rwxr-xr-x | mat2 | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | import os | 3 | import os |
| 4 | import shutil | 4 | import shutil |
| 5 | from typing import List, Union, Set | ||
| 5 | import sys | 6 | import sys |
| 6 | import mimetypes | 7 | import mimetypes |
| 7 | import argparse | 8 | import argparse |
| @@ -35,7 +36,7 @@ def __check_file(filename: str, mode: int = os.R_OK) -> bool: | |||
| 35 | __print_without_chars("[-] %s is not a regular file." % filename) | 36 | __print_without_chars("[-] %s is not a regular file." % filename) |
| 36 | return False | 37 | return False |
| 37 | elif not os.access(filename, mode): | 38 | elif not os.access(filename, mode): |
| 38 | mode_str = [] # type: list[str] | 39 | mode_str = [] # type: List[str] |
| 39 | if mode & os.R_OK: | 40 | if mode & os.R_OK: |
| 40 | mode_str += 'readable' | 41 | mode_str += 'readable' |
| 41 | if mode & os.W_OK: | 42 | if mode & os.W_OK: |
| @@ -151,10 +152,10 @@ def clean_meta(filename: str, is_lightweight: bool, inplace: bool, sandbox: bool | |||
| 151 | 152 | ||
| 152 | def show_parsers(): | 153 | def show_parsers(): |
| 153 | print('[+] Supported formats:') | 154 | print('[+] Supported formats:') |
| 154 | formats = set() # set[str] | 155 | formats = set() # Set[str] |
| 155 | for parser in parser_factory._get_parsers(): # type: ignore | 156 | for parser in parser_factory._get_parsers(): # type: ignore |
| 156 | for mtype in parser.mimetypes: | 157 | for mtype in parser.mimetypes: |
| 157 | extensions = set() # set[str] | 158 | extensions = set() # Set[str] |
| 158 | for extension in mimetypes.guess_all_extensions(mtype): | 159 | for extension in mimetypes.guess_all_extensions(mtype): |
| 159 | if extension not in UNSUPPORTED_EXTENSIONS: | 160 | if extension not in UNSUPPORTED_EXTENSIONS: |
| 160 | extensions.add(extension) | 161 | extensions.add(extension) |
| @@ -166,8 +167,8 @@ def show_parsers(): | |||
| 166 | print('\n'.join(sorted(formats))) | 167 | print('\n'.join(sorted(formats))) |
| 167 | 168 | ||
| 168 | 169 | ||
| 169 | def __get_files_recursively(files: list[str]) -> list[str]: | 170 | def __get_files_recursively(files: List[str]) -> List[str]: |
| 170 | ret = set() # type: set[str] | 171 | ret = set() # type: Set[str] |
| 171 | for f in files: | 172 | for f in files: |
| 172 | if os.path.isdir(f): | 173 | if os.path.isdir(f): |
| 173 | for path, _, _files in os.walk(f): | 174 | for path, _, _files in os.walk(f): |
