Skip to content

Commit 28f584a

Browse files
committed
fix: cleanup joserfc.util
1 parent b1e16e1 commit 28f584a

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

src/joserfc/util.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import struct
55
import binascii
66
import json
7-
from .errors import DecodeError
7+
88

99
def to_bytes(x: Any, charset: str = "utf-8", errors: str = "strict") -> bytes:
1010
if isinstance(x, bytes):
@@ -21,16 +21,6 @@ def to_str(x: bytes | str, charset: str = "utf-8") -> str:
2121
return x.decode(charset)
2222
return x
2323

24-
def __is_urlsafe_b64_encoding_non_canonical(s: bytes) -> bool:
25-
p = len(s) % 4 # padding?
26-
if p == 0:
27-
return False
28-
p = 4 - p # number of padding characters
29-
if p == 2 and s[-1] in b"AQgw":
30-
return False
31-
if p == 1 and s[-1] in b"AEIMQUYcgkosw048":
32-
return False
33-
return True
3424

3525
def urlsafe_b64decode(s: bytes) -> bytes:
3626
if b"+" in s or b"/" in s:

0 commit comments

Comments
 (0)