Skip to content

Commit c79e2bd

Browse files
committed
Fixed codec: baudot
1 parent ad01045 commit c79e2bd

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

codext/binary/baudot.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from ..__common__ import *
1111

1212

13-
__CODES = ["ccitt1", "ccitt2", "eu", "ita1", "ita2", "ita2_us", "murray", "uk"]
13+
__CODES = ["ccitt1", "ccitt2", "eu", "ita1", "ita2", "ita2_us"]
1414
if PY3:
15-
__CODES.extend(["ita2_meteo", "mtk2"])
15+
__CODES.extend(["ita2_meteo", "mtk2", "murray", "uk"])
1616
__guess__ = ["baudot%s-{}-{}".format(x, y) for x in __CODES for y in ["lsb", "msb"]]
1717
__examples1__ = {
1818
'enc(baudot-BAD_ALPHABET)': None,
@@ -51,7 +51,7 @@
5151

5252

5353
PATTERN = r"^baudot%s([-_](?:ccitt1|ccitt2|eu|fr|ita1|ita2|ita2[-_](?:us" + (r"|meteo" if PY3 else r"") + r")" + \
54-
(r"|mtk2" if PY3 else r"") + r"|murray|uk|us_tty)(?:[-_](?:lsb|msb))?)?$"
54+
(r"|mtk2|murray|uk" if PY3 else r"") + r"|us_tty)(?:[-_](?:lsb|msb))?)?$"
5555
# reserved character
5656
RES_CHR = "\xff"
5757

@@ -116,20 +116,22 @@
116116
"\x003\n- '87\r\xff4Ю,Э:(5+)2Щ6019?Ш\xff./=\xff",
117117
]
118118
# Murray code ; NB: not all fractions are supported (source: https://en.wikipedia.org/wiki/Baudot_code)
119-
MURRAY = [
120-
"00100", "11011",
121-
" E\xffA\xffSIU\nDRJNFCKTZLWHYPQOBF\xffMXV\x7f",
122-
"\x003\xff\xff\xff'87\n²4\xff-\u215f(\xff5./2\xff6019?\xff\xff,£)*" if PY3 else \
123-
"\x003\xff\xff\xff'87\n²4\xff-\u215f(\xff5./2\xff6019?\xff\xff,$)*",
124-
]
119+
if PY3:
120+
MURRAY = [
121+
"00100", "11011",
122+
" E\xffA\xffSIU\nDRJNFCKTZLWHYPQOBF\xffMXV\x7f",
123+
"\x003\xff\xff\xff'87\n²4\xff-\u215f(\xff5./2\xff6019?\xff\xff,£)*" if PY3 else \
124+
"\x003\xff\xff\xff'87\n²4\xff-\u215f(\xff5./2\xff6019?\xff\xff,$)*",
125+
]
125126
# English Baudot ; NB: not all fractions are supported (sources: https://fr.qwe.wiki/wiki/Baudot_code
126127
# https://en.wikipedia.org/wiki/Baudot_code)
127-
UK = [
128-
"10000", "01000",
129-
"\x00AE/YUIO\xffJGHBCFD -XZSTWV\x7fKMLRQNP",
130-
"\x0012\u215f34\xff5 67\xb989\xff0\xff.\xff:\xff²?'\x7f()=-/£+" if PY3 else \
131-
"\x0012\xff34\xff5 67\xb989\xff0\xff.\xff:\xff²?'\x7f()=-/$+",
132-
]
128+
if PY3:
129+
UK = [
130+
"10000", "01000",
131+
"\x00AE/YUIO\xffJGHBCFD -XZSTWV\x7fKMLRQNP",
132+
"\x0012\u215f34\xff5 67\xb989\xff0\xff.\xff:\xff²?'\x7f()=-/£+" if PY3 else \
133+
"\x0012\xff34\xff5 67\xb989\xff0\xff.\xff:\xff²?'\x7f()=-/$+",
134+
]
133135

134136

135137
def _bits_from_tape(tape, trans={'*': "1", ' ': "0"}):

0 commit comments

Comments
 (0)