Ran black code formatter on everything.
[python_utils.git] / letter_compress.py
index 9a6f32db43fb09762cca71f79cb268a8862e2452..9b4cf194c3d97a83c68c47bd0199a65c3a6e1698 100644 (file)
@@ -2,9 +2,9 @@
 
 import bitstring
 
-from collect.bidict import bidict
+from collect.bidict import BiDict
 
-special_characters = bidict(
+special_characters = BiDict(
     {
         ' ': 27,
         '.': 28,
@@ -34,10 +34,12 @@ def compress(uncompressed: str) -> bytes:
     compressed = bitstring.BitArray()
     for (n, letter) in enumerate(uncompressed):
         if 'a' <= letter <= 'z':
-            bits = ord(letter) - ord('a') + 1   # 1..26
+            bits = ord(letter) - ord('a') + 1  # 1..26
         else:
             if letter not in special_characters:
-                raise Exception(f'"{uncompressed}" contains uncompressable char="{letter}"')
+                raise Exception(
+                    f'"{uncompressed}" contains uncompressable char="{letter}"'
+                )
             bits = special_characters[letter]
         compressed.append(f"uint:5={bits}")
     while len(compressed) % 8 != 0:
@@ -100,4 +102,5 @@ def decompress(kompressed: bytes) -> str:
 
 if __name__ == '__main__':
     import doctest
+
     doctest.testmod()