Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jvoisin
mat2
Commits
e8b38f11
Commit
e8b38f11
authored
Jan 14, 2023
by
jvoisin
Browse files
Revert "Simplify a bit the typing annotations of ./mat2"
This reverts commit
29057d6c
.
parent
8d7230ba
Pipeline
#124739
failed with stages
in 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
mat2
View file @
e8b38f11
...
...
@@ -2,6 +2,7 @@
import
os
import
shutil
from
typing
import
List
,
Union
,
Set
import
sys
import
mimetypes
import
argparse
...
...
@@ -35,7 +36,7 @@ def __check_file(filename: str, mode: int = os.R_OK) -> bool:
__print_without_chars
(
"[-] %s is not a regular file."
%
filename
)
return
False
elif
not
os
.
access
(
filename
,
mode
):
mode_str
=
[]
# type:
l
ist[str]
mode_str
=
[]
# type:
L
ist[str]
if
mode
&
os
.
R_OK
:
mode_str
+=
'readable'
if
mode
&
os
.
W_OK
:
...
...
@@ -151,10 +152,10 @@ def clean_meta(filename: str, is_lightweight: bool, inplace: bool, sandbox: bool
def
show_parsers
():
print
(
'[+] Supported formats:'
)
formats
=
set
()
#
s
et[str]
formats
=
set
()
#
S
et[str]
for
parser
in
parser_factory
.
_get_parsers
():
# type: ignore
for
mtype
in
parser
.
mimetypes
:
extensions
=
set
()
#
s
et[str]
extensions
=
set
()
#
S
et[str]
for
extension
in
mimetypes
.
guess_all_extensions
(
mtype
):
if
extension
not
in
UNSUPPORTED_EXTENSIONS
:
extensions
.
add
(
extension
)
...
...
@@ -166,8 +167,8 @@ def show_parsers():
print
(
'
\n
'
.
join
(
sorted
(
formats
)))
def
__get_files_recursively
(
files
:
l
ist
[
str
])
->
l
ist
[
str
]:
ret
=
set
()
# type:
s
et[str]
def
__get_files_recursively
(
files
:
L
ist
[
str
])
->
L
ist
[
str
]:
ret
=
set
()
# type:
S
et[str]
for
f
in
files
:
if
os
.
path
.
isdir
(
f
):
for
path
,
_
,
_files
in
os
.
walk
(
f
):
...
...
jvoisin
@jvoisin
mentioned in issue
#184 (closed)
·
Jan 14, 2023
mentioned in issue
#184 (closed)
mentioned in issue #184
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment