Tue, 02 Feb 2016 20:47:47 +0200
Stuff
158
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | #!/usr/bin/env python3 |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | # encoding: utf-8 |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | Provides the munge function. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | import string |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | mungechars = 'аɓᴄđеƒɡɦіјķɭṁɳорqŗѕƫᴜᴠᴡхуᴢАВСḌЕḞǴНІЈКLМΝОРQɌЅТÙⅤⱲХΥΖ' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | mungedict = dict (zip (string.ascii_lowercase + string.ascii_uppercase, mungechars)) |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | def mungeone (ch): |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | Munges one character. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | try: |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | return mungedict[ch] |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | except: |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | return ch |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | def munge (a): |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | Munges the given string |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | ''' |
162
d24fe5e3e420
Added cdf (aka Φ(x)) to the calculator, removed unneeded list comprehensions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
159
diff
changeset
|
24 | return ''.join (mungeone(ch) for ch in a) |