mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2024-11-14 17:40:24 -08:00
f98d6fff65
* Added Python3.12 and future 3.13 * Fix Radarr result handling * remove py2.7 and py3.7 support
26 lines
643 B
Python
26 lines
643 B
Python
qwerty = "-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
|
|
dvorak = "[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"
|
|
|
|
|
|
to_dvorak = str.maketrans(qwerty, dvorak)
|
|
to_qwerty = str.maketrans(dvorak, qwerty)
|
|
|
|
|
|
def translate(input, translation):
|
|
"""
|
|
>>> translate('dvorak', to_dvorak)
|
|
'ekrpat'
|
|
>>> translate('qwerty', to_qwerty)
|
|
'x,dokt'
|
|
"""
|
|
return input.translate(translation)
|
|
|
|
|
|
def _translate_stream(stream, translation):
|
|
"""
|
|
>>> import io
|
|
>>> _translate_stream(io.StringIO('foo'), to_dvorak)
|
|
urr
|
|
"""
|
|
print(translate(stream.read(), translation))
|