Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-mtconverter
Commits
43d11fe4a60b
Commit
abe6ac63
authored
Jul 28, 2021
by
Laurent Peuch
Browse files
chore(format-source): black the code
parent
bad260cf0c62
Pipeline
#71897
failed with stages
in 1 minute and 44 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.hg-format-source
View file @
43d11fe4
...
...
@@ -49,3 +49,20 @@
{"pattern": "test/test_engine.py", "tool": "pyupgrade"}
{"pattern": "test/test_transforms.py", "tool": "pyupgrade"}
{"pattern": "test/test_utils.py", "tool": "pyupgrade"}
{"pattern": "__pkginfo__.py", "tool": "black"}
{"pattern": "logilab/__init__.py", "tool": "black"}
{"pattern": "logilab/mtconverter/__init__.py", "tool": "black"}
{"pattern": "logilab/mtconverter/engine.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transform.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/__init__.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/cmdtransforms.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/htmltransform.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/odt2text.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/pgpsignature.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/piltransforms.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/pygmentstransforms.py", "tool": "black"}
{"pattern": "logilab/mtconverter/transforms/python.py", "tool": "black"}
{"pattern": "setup.py", "tool": "black"}
{"pattern": "test/test_engine.py", "tool": "black"}
{"pattern": "test/test_transforms.py", "tool": "black"}
{"pattern": "test/test_utils.py", "tool": "black"}
logilab/mtconverter/__init__.py
View file @
43d11fe4
...
...
@@ -146,9 +146,7 @@ for c in ("\n", "\r", "\t"):
_TR_CONTROL_CHARS
[
ord
(
"
\f
"
)]
=
"
\n
"
_TR_CONTROL_CHARS
[
ord
(
"
\v
"
)]
=
"
\n
"
TR_CONTROL_CHARS
=
[
c
.
encode
(
"ascii"
)
for
c
in
_TR_CONTROL_CHARS
]
ESC_CAR_TABLE
=
maketrans
(
b
""
.
join
(
CONTROL_CHARS
),
b
""
.
join
(
TR_CONTROL_CHARS
)
)
ESC_CAR_TABLE
=
maketrans
(
b
""
.
join
(
CONTROL_CHARS
),
b
""
.
join
(
TR_CONTROL_CHARS
))
ESC_UCAR_TABLE
=
ESC_CAR_TABLE
.
decode
(
"latin1"
)
...
...
logilab/mtconverter/transforms/cmdtransforms.py
View file @
43d11fe4
...
...
@@ -64,7 +64,7 @@ class POpenTransform(Transform):
binary
:
str
=
None
,
cmdargs
:
str
=
None
,
use_stdin
:
bool
=
None
,
**
kwargs
:
Any
**
kwargs
:
Any
,
)
->
None
:
if
name
is
not
None
:
self
.
name
=
name
...
...
test/test_transforms.py
View file @
43d11fe4
...
...
@@ -51,15 +51,11 @@ class MiscTransformsTC(TestCase):
self
.
assertEqual
(
converted
,
"yo
\n
zogzog"
)
def
test_binary_html_to_text
(
self
):
data
=
TransformData
(
"<b>yo (zou éà ;)</b>"
.
encode
(),
"text/html"
,
"utf8"
)
data
=
TransformData
(
"<b>yo (zou éà ;)</b>"
.
encode
(),
"text/html"
,
"utf8"
)
converted
=
ENGINE
.
convert
(
data
,
"text/plain"
).
decode
().
strip
()
self
.
assertEqual
(
converted
,
"**yo (zou éà ;)**"
)
data
=
TransformData
(
b
"<p>yo <br/>zogzog </p>"
,
"text/html"
,
"utf8"
)
data
=
TransformData
(
b
"<p>yo <br/>zogzog </p>"
,
"text/html"
,
"utf8"
)
converted
=
ENGINE
.
convert
(
data
,
"text/plain"
).
decode
().
strip
()
self
.
assertEqual
(
converted
,
"yo
\n
zogzog"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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