Blob Blame History Raw
From 0156785a14ab3d120dcf7c3650a79c4aba6aa9c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 19 Jul 2019 16:22:21 +0200
Subject: [PATCH 01/71] py3: fix invalid escapes

python3.8 warns about strings which try to escape characters which do
not need that. To avoid the warning, the backslash should be escaped.
(Behaviour is functionally the same, so e.g. '\$' is still the same as
r'\$', except for the warning.)
---
 .../ebooks/unihandecode/unicodepoints.py      | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/calibre/ebooks/unihandecode/unicodepoints.py b/src/calibre/ebooks/unihandecode/unicodepoints.py
index fe1495de73..d9130123fb 100644
--- a/src/calibre/ebooks/unihandecode/unicodepoints.py
+++ b/src/calibre/ebooks/unihandecode/unicodepoints.py
@@ -194,7 +194,7 @@ CODEPOINTS = {
 		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'Sh', 'D', 'Gh', '&', '+m',
 	],
 	'x07': [
-		'//', '/', ',', '!', '!', '-', ',', ',', ';', '?', '~', '\{', '\}', '*', '[?]', '',
+		'//', '/', ',', '!', '!', '-', ',', ',', ';', '?', '~', '\\{', '\\}', '*', '[?]', '',
 		'\'', '', 'b', 'g', 'g', 'd', 'd', 'h', 'w', 'z', 'H', 't', 't', 'y', 'yh', 'k',
 		'l', 'm', 'n', 's', 's', '`', 'p', 'p', 'S', 'q', 'r', 'sh', 't', '[?]', '[?]', '[?]',
 		'a', 'a', 'a', 'A', 'A', 'A', 'e', 'e', 'e', 'E', 'i', 'i', 'u', 'u', 'u', 'o',
@@ -844,7 +844,7 @@ CODEPOINTS = {
 	'x28': [
 		' ', 'a', '1', 'b', '\'', 'k', '2', 'l', '@', 'c', 'i', 'f', '/', 'm', 's', 'p',
 		'"', 'e', '3', 'h', '9', 'o', '6', 'r', '^', 'd', 'j', 'g', '>', 'n', 't', 'q',
-		',', '*', '5', '<', '-', 'u', '8', 'v', '.', '%', '[', '\$', '+', 'x', '!', '&',
+		',', '*', '5', '<', '-', 'u', '8', 'v', '.', '%', '[', '\\$', '+', 'x', '!', '&',
 		';', ':', '4', '\\', '0', 'z', '7', '(', '_', '?', 'w', ']', '#', 'y', ')', '=',
 		'[d7]', '[d17]', '[d27]', '[d127]', '[d37]', '[d137]', '[d237]', '[d1237]', '[d47]', '[d147]', '[d247]', '[d1247]', '[d347]', '[d1347]', '[d2347]', '[d12347]',
 		'[d57]', '[d157]', '[d257]', '[d1257]', '[d357]', '[d1357]', '[d2357]', '[d12357]', '[d457]', '[d1457]', '[d2457]', '[d12457]', '[d3457]', '[d13457]', '[d23457]', '[d123457]',
@@ -916,15 +916,15 @@ CODEPOINTS = {
 	'x00': [
 		'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
 		'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
-		' ', '!', '"', '#', '\$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
+		' ', '!', '"', '#', '\\$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
 		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
 		'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
 		'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ']', '\\', ']', '^', '_',
 		'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
-		'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\{', '|', '\}', '~', '\x7f',
+		'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\\{', '|', '\\}', '~', '\x7f',
 		'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
 		'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
-		' ', '!', 'C/', 'PS', '\$?', 'Y=', '|', 'SS', '"', '(c)', 'a', '<<', '!', '', '(r)', '-',
+		' ', '!', 'C/', 'PS', '\\$?', 'Y=', '|', 'SS', '"', '(c)', 'a', '<<', '!', '', '(r)', '-',
 		'deg', '+-', '2', '3', '\'', 'u', 'P', '*', ',', '1', 'o', '>>', '1/4', '1/2', '3/4', '?',
 		'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I',
 		'D', 'N', 'O', 'O', 'O', 'O', 'O', 'x', 'O', 'U', 'U', 'U', 'U', 'U', 'Th', 'ss',
@@ -935,10 +935,10 @@ CODEPOINTS = {
 		'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]',
 		'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]',
 		'', '', '', '~', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]',
-		'..', '--', '-', '_', '_', '(', ') ', '\{', '\} ', '[', '] ', '[(', ')] ', '<<', '>> ', '<',
-		'> ', '[', '] ', '\{', '\}', '[?]', '[?]', '[?]', '[?]', '', '', '', '', '', '', '',
-		',', ',', '.', '', ';', ':', '?', '!', '-', '(', ')', '\{', '\}', '\{', '\}', '#',
-		'&', '*', '+', '-', '<', '>', '=', '', '\\', '\$', '%', '@', '[?]', '[?]', '[?]', '[?]',
+		'..', '--', '-', '_', '_', '(', ') ', '\\{', '\\} ', '[', '] ', '[(', ')] ', '<<', '>> ', '<',
+		'> ', '[', '] ', '\\{', '\\}', '[?]', '[?]', '[?]', '[?]', '', '', '', '', '', '', '',
+		',', ',', '.', '', ';', ':', '?', '!', '-', '(', ')', '\\{', '\\}', '\\{', '\\}', '#',
+		'&', '*', '+', '-', '<', '>', '=', '', '\\', '\\$', '%', '@', '[?]', '[?]', '[?]', '[?]',
 		'', '', '', '[?]', '', '[?]', '', '', '', '', '', '', '', '', '', '',
 		'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
 		'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
@@ -1256,12 +1256,12 @@ CODEPOINTS = {
 		'maels', 'maelt', 'maelp', 'maelh', 'maem', 'maeb', 'maebs', 'maes', 'maess', 'maeng', 'maej', 'maec', 'maek', 'maet', 'maep', 'maeh',
 	],
 	'xff': [
-		'[?]', '!', '"', '#', '\$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
+		'[?]', '!', '"', '#', '\\$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
 		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
 		'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
 		'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
 		'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
-		'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\{', '|', '\}', '~', '[?]',
+		'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\\{', '|', '\\}', '~', '[?]',
 		'[?]', '.', '[', ']', ',', '*', 'wo', 'a', 'i', 'u', 'e', 'o', 'ya', 'yu', 'yo', 'tu',
 		'+', 'a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'si', 'su', 'se', 'so',
 		'ta', 'ti', 'tu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'hu', 'he', 'ho', 'ma',
@@ -1271,7 +1271,7 @@ CODEPOINTS = {
 		'[?]', '[?]', 'a', 'ae', 'ya', 'yae', 'eo', 'e', '[?]', '[?]', 'yeo', 'ye', 'o', 'wa', 'wae', 'oe',
 		'[?]', '[?]', 'yo', 'u', 'weo', 'we', 'wi', 'yu', '[?]', '[?]', 'eu', 'yi', 'i', '[?]', '[?]', '[?]',
 		'/C', 'PS', '!', '-', '|', 'Y=', 'W=', '[?]', '|', '-', '|', '-', '|', '#', 'O', '[?]',
-		'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '\{', '|', '\}', '', '', '', '',
+		'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '\\{', '|', '\\}', '', '', '', '',
 	],
 	'xc3': [
 		'ssal', 'ssalg', 'ssalm', 'ssalb', 'ssals', 'ssalt', 'ssalp', 'ssalh', 'ssam', 'ssab', 'ssabs', 'ssas', 'ssass', 'ssang', 'ssaj', 'ssac',
@@ -1652,7 +1652,7 @@ CODEPOINTS = {
 		'cwil', 'cwilg', 'cwilm', 'cwilb', 'cwils', 'cwilt', 'cwilp', 'cwilh', 'cwim', 'cwib', 'cwibs', 'cwis', 'cwiss', 'cwing', 'cwij', 'cwic',
 	],
 	'x30': [
-		' ', ', ', '. ', '"', '[JIS]', '"', '/', '0', '<', '> ', '<<', '>> ', '[', '] ', '\{', '\} ',
+		' ', ', ', '. ', '"', '[JIS]', '"', '/', '0', '<', '> ', '<<', '>> ', '[', '] ', '\\{', '\\} ',
 		'[(', ')] ', '@', 'X ', '[', '] ', '[[', ']] ', '((', ')) ', '[[', ']] ', '~ ', '``', '\'\'', ',,',
 		'@', '1', '2', '3', '4', '5', '6', '7', '8', '9', '', '', '', '', '', '',
 		'~', '+', '+', '+', '+', '', '@', ' // ', '+10+', '+20+', '+30+', '[?]', '[?]', '[?]', '', '',