format with black
This commit is contained in:
parent
cbf887ed02
commit
70d4da1364
16
doc/conf.py
16
doc/conf.py
|
@ -66,8 +66,8 @@ source_suffix = ".rst"
|
||||||
master_doc = "index"
|
master_doc = "index"
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u"python-escpos"
|
project = "python-escpos"
|
||||||
copyright = u"2016, Manuel F Martinez and others"
|
copyright = "2016, Manuel F Martinez and others"
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
@ -229,8 +229,8 @@ latex_documents = [
|
||||||
(
|
(
|
||||||
"index",
|
"index",
|
||||||
"python-escpos.tex",
|
"python-escpos.tex",
|
||||||
u"python-escpos Documentation",
|
"python-escpos Documentation",
|
||||||
u"Manuel F Martinez and others",
|
"Manuel F Martinez and others",
|
||||||
"manual",
|
"manual",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -264,8 +264,8 @@ man_pages = [
|
||||||
(
|
(
|
||||||
"index",
|
"index",
|
||||||
"python-escpos",
|
"python-escpos",
|
||||||
u"python-escpos Documentation",
|
"python-escpos Documentation",
|
||||||
[u"Manuel F Martinez and others"],
|
["Manuel F Martinez and others"],
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -283,8 +283,8 @@ texinfo_documents = [
|
||||||
(
|
(
|
||||||
"index",
|
"index",
|
||||||
"python-escpos",
|
"python-escpos",
|
||||||
u"python-escpos Documentation",
|
"python-escpos Documentation",
|
||||||
u"Manuel F Martinez and others",
|
"Manuel F Martinez and others",
|
||||||
"python-escpos",
|
"python-escpos",
|
||||||
"One line description of project.",
|
"One line description of project.",
|
||||||
"Miscellaneous",
|
"Miscellaneous",
|
||||||
|
|
|
@ -68,7 +68,7 @@ def forecast(idx):
|
||||||
printer.text(deg)
|
printer.text(deg)
|
||||||
printer.text("\n")
|
printer.text("\n")
|
||||||
# take care of pesky unicode dash
|
# take care of pesky unicode dash
|
||||||
printer.text(cond.replace(u"\u2013", "-").encode("utf-8"))
|
printer.text(cond.replace("\u2013", "-").encode("utf-8"))
|
||||||
printer.text("\n \n")
|
printer.text("\n \n")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1078,7 +1078,7 @@ class EscposIO(object):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
self.printer.set(**params)
|
self.printer.set(**params)
|
||||||
if isinstance(text, six.text_type):
|
if isinstance(text, six.text_type):
|
||||||
self.printer.text(u"{0}\n".format(line))
|
self.printer.text("{0}\n".format(line))
|
||||||
else:
|
else:
|
||||||
self.printer.text("{0}\n".format(line))
|
self.printer.text("{0}\n".format(line))
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Encoder(object):
|
||||||
assert len(encodable_chars) == 128
|
assert len(encodable_chars) == 128
|
||||||
return encodable_chars
|
return encodable_chars
|
||||||
elif "python_encode" in codepage:
|
elif "python_encode" in codepage:
|
||||||
encodable_chars = [u" "] * 128
|
encodable_chars = [" "] * 128
|
||||||
for i in range(0, 128):
|
for i in range(0, 128):
|
||||||
codepoint = i + 128
|
codepoint = i + 128
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -24,13 +24,13 @@ class TestEncoder:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_can_encode(self):
|
def test_can_encode(self):
|
||||||
assert not Encoder({"CP437": 1}).can_encode("CP437", u"€")
|
assert not Encoder({"CP437": 1}).can_encode("CP437", "€")
|
||||||
assert Encoder({"CP437": 1}).can_encode("CP437", u"á")
|
assert Encoder({"CP437": 1}).can_encode("CP437", "á")
|
||||||
assert not Encoder({"foobar": 1}).can_encode("foobar", "a")
|
assert not Encoder({"foobar": 1}).can_encode("foobar", "a")
|
||||||
|
|
||||||
def test_find_suitable_encoding(self):
|
def test_find_suitable_encoding(self):
|
||||||
assert not Encoder({"CP437": 1}).find_suitable_encoding(u"€")
|
assert not Encoder({"CP437": 1}).find_suitable_encoding("€")
|
||||||
assert Encoder({"CP858": 1}).find_suitable_encoding(u"€") == "CP858"
|
assert Encoder({"CP858": 1}).find_suitable_encoding("€") == "CP858"
|
||||||
|
|
||||||
@raises(ValueError)
|
@raises(ValueError)
|
||||||
def test_get_encoding(self):
|
def test_get_encoding(self):
|
||||||
|
@ -90,7 +90,7 @@ class TestMagicEncode:
|
||||||
encoder=Encoder({"CP437": 1}),
|
encoder=Encoder({"CP437": 1}),
|
||||||
encoding="CP437",
|
encoding="CP437",
|
||||||
)
|
)
|
||||||
encode.write(u"€ ist teuro.")
|
encode.write("€ ist teuro.")
|
||||||
assert driver.output == b"_ ist teuro."
|
assert driver.output == b"_ ist teuro."
|
||||||
|
|
||||||
class TestForceEncoding:
|
class TestForceEncoding:
|
||||||
|
|
Loading…
Reference in New Issue