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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Magnin
mat2
Commits
120b2049
Commit
120b2049
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Change a bit the previous commit
parent
f3cef319
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libmat2/__init__.py
+3
-2
3 additions, 2 deletions
libmat2/__init__.py
mat2
+8
-7
8 additions, 7 deletions
mat2
with
11 additions
and
9 deletions
libmat2/__init__.py
+
3
−
2
View file @
120b2049
...
...
@@ -2,7 +2,7 @@
import
os
import
collections
from
enum
import
E
num
import
e
num
import
importlib
from
typing
import
Dict
,
Optional
...
...
@@ -64,7 +64,8 @@ def check_dependencies() -> dict:
return
ret
class
UnknownMemberPolicy
(
Enum
):
@enum.unique
class
UnknownMemberPolicy
(
enum
.
Enum
):
ABORT
=
'
abort
'
OMIT
=
'
omit
'
KEEP
=
'
keep
'
This diff is collapsed.
Click to expand it.
mat2
+
8
−
7
View file @
120b2049
...
...
@@ -10,8 +10,8 @@ import multiprocessing
import
logging
try
:
from
libmat2
import
(
parser_factory
,
UNSUPPORTED_EXTENSIONS
,
check_dependencies
,
UnknownMemberPolicy
)
from
libmat2
import
parser_factory
,
UNSUPPORTED_EXTENSIONS
from
libmat2
import
check_dependencies
,
UnknownMemberPolicy
except
ValueError
as
e
:
print
(
e
)
sys
.
exit
(
1
)
...
...
@@ -44,7 +44,7 @@ def create_arg_parser():
help
=
'
show more verbose status information
'
)
parser
.
add_argument
(
'
--unknown-members
'
,
metavar
=
'
policy
'
,
default
=
'
abort
'
,
help
=
'
how to handle unknown members of archive-style files (policy should
'
+
'
be one of:
'
+
'
,
'
.
join
(
[
x
.
value
for
x
in
UnknownMemberPolicy
])
+
'
)
'
)
'
be one of:
%s)
'
%
'
,
'
.
join
(
p
.
value
for
p
in
UnknownMemberPolicy
)
)
info
=
parser
.
add_mutually_exclusive_group
()
...
...
@@ -141,11 +141,12 @@ def main():
unknown_member_policy
=
UnknownMemberPolicy
(
args
.
unknown_members
)
if
unknown_member_policy
==
UnknownMemberPolicy
.
KEEP
:
logging
.
warning
(
'
Keeping unknown member files may leak metadata in the resulting file!
'
)
p
=
multiprocessing
.
Pool
()
mode
=
(
args
.
lightweight
is
True
)
l
=
zip
(
__get_files_recursively
(
args
.
files
),
itertools
.
repeat
(
mode
),
itertools
.
repeat
(
unknown_member_policy
))
rep_mode
=
itertools
.
repeat
(
args
.
lightweight
is
True
)
rep_policy
=
itertools
.
repeat
(
unknown_member_policy
)
l
=
zip
(
__get_files_recursively
(
args
.
files
),
rep_mode
,
rep_policy
)
p
=
multiprocessing
.
Pool
()
ret
=
list
(
p
.
imap_unordered
(
clean_meta
,
list
(
l
)))
return
0
if
all
(
ret
)
else
-
1
...
...
This diff is collapsed.
Click to expand it.
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