Compare commits

...

3 Commits

Author SHA1 Message Date
jesopo c21545e2c2 extraneous space 2022-01-29 21:19:43 +00:00
jesopo 275b2c7f3d slightly neater casemap.py 2022-01-29 21:19:31 +00:00
jesopo 1333228fd1 upgrade irctokens to v2.0.2 2022-01-29 21:18:41 +00:00
3 changed files with 6 additions and 9 deletions

View File

@ -1,20 +1,17 @@
from enum import Enum
from string import ascii_lowercase, ascii_uppercase
from typing import Dict, List
from typing import Dict, List, Optional
class CaseMap(Enum):
ASCII = "ascii"
RFC1459 = "rfc1459"
def _make_trans(upper: str, lower: str):
return str.maketrans(dict(zip(upper, lower)))
CASEMAPS: Dict[CaseMap, Dict[int, str]] = {
CaseMap.ASCII: _make_trans(
CASEMAPS: Dict[CaseMap, Dict[int, Optional[int]]] = {
CaseMap.ASCII: str.maketrans(
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
r"abcdefghijklmnopqrstuvwxyz"
),
CaseMap.RFC1459: _make_trans(
CaseMap.RFC1459: str.maketrans(
r"ABCDEFGHIJKLMNOPQRSTUVWXYZ\[]^",
r"abcdefghijklmnopqrstuvwxyz|{}~"
)

View File

@ -5,7 +5,7 @@ from ..casemap import CaseMap
CASEMAPPINGS = ["rfc1459", "ascii"]
def _parse_escapes(s: str):
idx = 0
idx = 0
out = ""
while idx < (len(s)):

View File

@ -1,4 +1,4 @@
cachetools ~=5.0.0
freezegun ~=1.1.0
irctokens ~=2.0.0
irctokens ~=2.0.2
pendulum ~=2.1.0