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