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
Model registry
Monitor
Service Desk
Analyze
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
jvoisin
mat2
Commits
8ff57c58
Commit
8ff57c58
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Do not display control characters in output
Kudos to Sherry Taylor for reporting this issue
parent
04bb8c8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mat2
+10
-0
10 additions, 0 deletions
mat2
tests/test_climat2.py
+1
-1
1 addition, 1 deletion
tests/test_climat2.py
with
11 additions
and
1 deletion
mat2
+
10
−
0
View file @
8ff57c58
...
...
@@ -6,6 +6,7 @@ import sys
import
mimetypes
import
argparse
import
logging
import
unicodedata
try
:
from
libmat2
import
parser_factory
,
UNSUPPORTED_EXTENSIONS
...
...
@@ -83,6 +84,15 @@ def __print_meta(filename: str, metadata: dict, depth: int=1):
if
isinstance
(
v
,
dict
):
__print_meta
(
k
,
v
,
depth
+
1
)
continue
# Remove control characters
# We might use 'Cc' instead of 'C', but better safe than sorry
# https://www.unicode.org/reports/tr44/#GC_Values_Table
try
:
v
=
''
.
join
(
ch
for
ch
in
v
if
not
unicodedata
.
category
(
ch
).
startswith
(
'
C
'
))
except
TypeError
:
pass
# for things that aren't iterable
try
:
# FIXME this is ugly.
print
(
padding
+
"
%s: %s
"
%
(
k
,
v
))
except
UnicodeEncodeError
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_climat2.py
+
1
−
1
View file @
8ff57c58
...
...
@@ -121,7 +121,7 @@ class TestGetMeta(unittest.TestCase):
proc
=
subprocess
.
Popen
(
mat2_binary
+
[
'
--show
'
,
'
./tests/data/dirty.pdf
'
],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertIn
(
b
'
p
roducer: pdfTeX-1.40.14
'
,
stdout
)
self
.
assertIn
(
b
'
P
roducer: pdfTeX-1.40.14
'
,
stdout
)
def
test_png
(
self
):
proc
=
subprocess
.
Popen
(
mat2_binary
+
[
'
--show
'
,
'
./tests/data/dirty.png
'
],
...
...
This diff is collapsed.
Click to expand it.
jvoisin
@jvoisin
mentioned in issue
#86 (closed)
·
6 years ago
mentioned in issue
#86 (closed)
mentioned in issue #86
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