jpayne@69: from __future__ import annotations jpayne@69: jpayne@69: import base64 jpayne@69: import logging jpayne@69: jpayne@69: log = logging.getLogger("wheel") jpayne@69: jpayne@69: jpayne@69: def urlsafe_b64encode(data: bytes) -> bytes: jpayne@69: """urlsafe_b64encode without padding""" jpayne@69: return base64.urlsafe_b64encode(data).rstrip(b"=") jpayne@69: jpayne@69: jpayne@69: def urlsafe_b64decode(data: bytes) -> bytes: jpayne@69: """urlsafe_b64decode without padding""" jpayne@69: pad = b"=" * (4 - (len(data) & 3)) jpayne@69: return base64.urlsafe_b64decode(data + pad)