diff options
author | William Carroll <wpcarro@gmail.com> | 2016-08-23T18·14-0400 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2016-08-23T18·14-0400 |
commit | c836c5508134cee1aa004a83784ccef162c9603c (patch) | |
tree | f8b16d77aadbbf94bcebbf56a54ef099dcb0ecef /.escape_codes_url.py | |
parent | 342e7dbcd9fb6954be127b43a7850e4513ef8304 (diff) | |
parent | 337ba2e247963c80446bfaa14399344fca83c202 (diff) |
Merge branch 'master' of https://github.com/wpcarro/pc_settings
Diffstat (limited to '.escape_codes_url.py')
-rw-r--r-- | .escape_codes_url.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/.escape_codes_url.py b/.escape_codes_url.py deleted file mode 100644 index 60aa1c210694..000000000000 --- a/.escape_codes_url.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/python - -""" -Forward and Backward lookups for URL escape sequences -""" - -import sys, re - - -literal_to_esccode = { - ' ': '%20', - '<': '%3C', - '>': '%3E', - '#': '%23', - '%': '%25', - '{': '%7B', - '}': '%7D', - '|': '%7C', - '\\': '%5C', - '^': '%5E', - '~': '%7E', - '[': '%5B', - ']': '%5D', - '`': '%60', - ';': '%3B', - '/': '%2F', - '?': '%3F', - ':': '%3A', - '@': '%40', - '=': '%3D', - '&': '%26', - '$': '%24', -} - - -esccode_to_literal = { - v: k for k, v in literal_to_esccode.items() -} - - -def is_esccode(string): - p = re.compile(r'^%\w\w$') - m = p.match(string) - return bool(p.match(string)) - - -try: - el = sys.argv[1] -except: - el = None - -if not el: - print literal_to_esccode -else: - msg = esccode_to_literal[el] if is_esccode(el) else literal_to_esccode[el] - print '"{0}": "{1}"'.format(el, msg) |