mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
Enable spell checking (#563)
* add spellchecking * improve spelling * improve spelling config * extend word list * improve spelling * improve spelling * escalate warning in spell check to failure * fix spelling * fix spelling * add plural * Update doc/spelling_wordlist.txt * do not stop on warning * require newest sphinxcontrib spelling * remove old comment * add authors as single line entry to spelling list * reenable stop on warning
This commit is contained in:
@@ -28,15 +28,9 @@ class Encoder(object):
|
||||
|
||||
Note: To determine the code page, it needs to do the conversion, and
|
||||
thus already knows what the final byte in the target encoding would
|
||||
be. Nevertheless, the API of this class doesn't return the byte.
|
||||
be. Nevertheless, the API of this class does not return the byte.
|
||||
|
||||
The caller use to do the character conversion itself.
|
||||
|
||||
$ python -m timeit -s "{u'ö':'a'}.get(u'ö')"
|
||||
100000000 loops, best of 3: 0.0133 usec per loop
|
||||
|
||||
$ python -m timeit -s "u'ö'.encode('latin1')"
|
||||
100000000 loops, best of 3: 0.0141 usec per loop
|
||||
"""
|
||||
|
||||
def __init__(self, codepage_map):
|
||||
@@ -117,7 +111,7 @@ class Encoder(object):
|
||||
return codepage_char_map
|
||||
|
||||
def can_encode(self, encoding, char):
|
||||
"""Determine if a character is encodeable in the given code page.
|
||||
"""Determine if a character is encodable in the given code page.
|
||||
|
||||
:param encoding: The name of the encoding.
|
||||
:param char: The character to attempt to encode.
|
||||
@@ -171,7 +165,7 @@ class Encoder(object):
|
||||
1. code pages that we already tried before; there is a good
|
||||
chance they might work again, reducing the search space,
|
||||
and by re-using already used encodings we might also
|
||||
reduce the number of codepage change instructiosn we have
|
||||
reduce the number of codepage change instruction we have
|
||||
to send. Still, any performance gains will presumably be
|
||||
fairly minor.
|
||||
|
||||
|
Reference in New Issue
Block a user