Sat, 05 Sep 2015 05:24:38 +0300
Munge the committer's name when posting a new commit to avoid highlights
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 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | Copyright 2015 Teemu Piippo |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | All rights reserved. |
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 | Redistribution and use in source and binary forms, with or without |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | modification, are permitted provided that the following conditions |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | are met: |
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 | 1. Redistributions of source code must retain the above copyright |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | notice, this list of conditions and the following disclaimer. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | 2. Redistributions in binary form must reproduce the above copyright |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | notice, this list of conditions and the following disclaimer in the |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | documentation and/or other materials provided with the distribution. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | 3. The name of the author may not be used to endorse or promote products |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | derived from this software without specific prior written permission. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | import string |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | 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
|
37 | 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
|
38 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | 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
|
40 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | 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
|
42 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | try: |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | 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
|
45 | except: |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | return ch |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | 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
|
49 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | 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
|
51 | ''' |
f96730dee026
Munge the committer's name when posting a new commit to avoid highlights
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | return ''.join ([mungeone (ch) for ch in a]) |