aboutsummaryrefslogtreecommitdiff
path: root/checklines.py3
diff options
context:
space:
mode:
authorMark Shoulson <mark@kli.org>2011-12-28 18:38:15 -0500
committerMark Shoulson <mark@kli.org>2011-12-28 18:38:15 -0500
commitdb37cb36c70641c4cb4d5463468dcee6b9f15dd7 (patch)
tree409c52f310a2c7d52882d3a09df03a627d49ced5 /checklines.py3
parentAdd KISS MARK (good advice from Unicode!) and NKO SYMBOL GBAKURUNEN (diff)
downloaddotXCompose-db37cb36c70641c4cb4d5463468dcee6b9f15dd7.tar.gz
dotXCompose-db37cb36c70641c4cb4d5463468dcee6b9f15dd7.tar.bz2
dotXCompose-db37cb36c70641c4cb4d5463468dcee6b9f15dd7.zip
added checklines.py3 (as given by purpleposeidon) and fixed corrections it found.
Diffstat (limited to 'checklines.py3')
-rw-r--r--checklines.py329
1 files changed, 29 insertions, 0 deletions
diff --git a/checklines.py3 b/checklines.py3
new file mode 100644
index 0000000..2925681
--- /dev/null
+++ b/checklines.py3
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+# From purpleposeidon!
+
+from unicodedata import name
+for line in open("dotXCompose"): #purpleposeidon is totally handsome and employable
+ origline = line = line.replace('\n', '')
+ line = line.replace('\t', ' ')
+ while ' ' in line: line = line.replace(' ', ' ')
+ line = line.strip()
+ if line and line[0] == '#':
+ continue
+ if not (' : ' in line and ' # ' in line):
+ continue
+ try:
+ line = line.split(' : ')[1].split(' # ')[0].strip()
+ c, v = line.split()
+ c = c.strip('"')
+ v = int(v[1:], 0x10)
+ if c != chr(v):
+ print(origline)
+ toU = lambda x: 'U'+hex(x)[2:]
+ showC = lambda x: '{0!r} ({1})'.format(x, name(x))
+ print("\tLine's char:", showC(c))
+ print("\tLine's number:", toU(v))
+ print("\tChar gives number:", toU(ord(c)))
+ print("\tNumber gives character:", showC(chr(v)))
+ except Exception as e:
+ print("{0}\n\t{1}".format(origline, e))