|
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: UTF-8 -*- |
| 3 | +"""Galactic Alphabet Codec - Minecraft enchantment language content encoding. |
| 4 | +
|
| 5 | +This codec: |
| 6 | +- en/decodes strings from str to str |
| 7 | +- en/decodes strings from bytes to bytes |
| 8 | +- decodes file content to str (read) |
| 9 | +- encodes file content from str to bytes (write) |
| 10 | +""" |
| 11 | +from ..__common__ import * |
| 12 | + |
| 13 | + |
| 14 | +__examples__ = { |
| 15 | + 'enc-dec(galactic|minecraft_enchanting_language)': ["test " + MASKS['l']], |
| 16 | + 'enc(galactic-alphabet|minecraft)': {'Bad test#': None}, |
| 17 | +} |
| 18 | + |
| 19 | + |
| 20 | +# source: https://shapecatcher.com |
| 21 | +ENCMAP = { |
| 22 | + 'a': ["ᒋ", "ᔑ"], 'b': ["⦣", "ゝ", "ʖ"], 'c': ["ì", "ᓵ"], 'd': "↸", 'e': ["ᒷ", "Ŀ"], 'f': ["𝌁", "⎓"], |
| 23 | + 'g': ["𐌝", "┤", "⫞", "⊣"], 'h': ["₸", "⍑", "╤"], 'i': "╎", 'j': ["⫶", "⁝", "ⵗ", "⋮"], 'k': "ꖌ", 'l': "ꖎ", |
| 24 | + 'm': ["ᒲ", "⟓"], 'n': ["ソ", "リ"], 'o': ["⁊", "フ", "ㇷ", "𝙹"], 'p': ["ⅱ", "ij", "‼", "!"], |
| 25 | + 'q': ["ᑑ", "⊐", "コ"], 'r': ["⸬", "∷", "⛚"], 's': ["߆", "𝈿", "ꝇ", "ᓭ"], 't': ["ℸ", "ヿ", "⅂", "Ꞁ"], |
| 26 | + 'u': ["⚍", "⍨"], 'v': ["𝍦", "⍊", "╧"], 'w': ["∴", "⸫", "⛬"], 'x': ["ꜘ", "╱", " ̷", "⟋"], |
| 27 | + 'y': ["║", "‖", "∥", "ǁ", "𝄁", "|"], 'z': ["ᑎ", "⋂", "∩", "⨅", "⛫"], |
| 28 | + ' ': [" ", "⠀"], |
| 29 | +} |
| 30 | + |
| 31 | + |
| 32 | +if PY3: |
| 33 | + add_map("galactic", ENCMAP, ignore_case="encode", printables_rate=0., |
| 34 | + pattern=r"^(?:galactic(?:[-_]alphabet)?|minecraft(?:[-_](?:enchantment|enchanting[-_]language))?)$") |
| 35 | + |
0 commit comments