Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jvoisin
mat2
Commits
29057d6c
Commit
29057d6c
authored
2 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Simplify a bit the typing annotations of ./mat2
parent
180ea24e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#118359
passed with warnings
2 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mat2
+5
-6
5 additions, 6 deletions
mat2
with
5 additions
and
6 deletions
mat2
+
5
−
6
View file @
29057d6c
...
...
@@ -2,7 +2,6 @@
import
os
import
shutil
from
typing
import
List
,
Union
,
Set
import
sys
import
mimetypes
import
argparse
...
...
@@ -36,7 +35,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
:
...
...
@@ -152,10 +151,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
)
...
...
@@ -167,8 +166,8 @@ def show_parsers():
__print_without_chars
(
'
\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
):
...
...
This diff is collapsed.
Click to expand it.
jvoisin
@jvoisin
mentioned in commit
e8b38f11
·
2 years ago
mentioned in commit
e8b38f11
mentioned in commit e8b38f110127aa507c1c6bb0f62cfb750872e468
Toggle commit list
georg
@georg
mentioned in merge request
!105 (merged)
·
2 years ago
mentioned in merge request
!105 (merged)
mentioned in merge request !105
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment