Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
utils.py: fix types in docstrings for base64url_encode/decode
  • Loading branch information
romanek-adam authored Jul 12, 2021
commit f5d96d82358e846506cb1ca715aada0c33a17b71
4 changes: 2 additions & 2 deletions jose/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def base64url_decode(input):
"""Helper method to base64url_decode a string.

Args:
input (str): A base64url_encoded string to decode.
input (bytes): A base64url_encoded string (bytes) to decode.
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The docstring repeats the type and uses 'base64url_encoded string'; consider simplifying to bytes: base64url-encoded value to decode.

Suggested change
input (bytes): A base64url_encoded string (bytes) to decode.
input (bytes): base64url-encoded value to decode.

Copilot uses AI. Check for mistakes.

"""
rem = len(input) % 4
Expand All @@ -82,7 +82,7 @@ def base64url_encode(input):
"""Helper method to base64url_encode a string.

Args:
input (str): A base64url_encoded string to encode.
input (bytes): A base64url_encoded string (bytes) to encode.
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description incorrectly implies the input is already encoded. It should read something like bytes: raw data to encode using base64url.

Suggested change
input (bytes): A base64url_encoded string (bytes) to encode.
input (bytes): Raw binary data (bytes) to encode using base64url.

Copilot uses AI. Check for mistakes.

"""
return base64.urlsafe_b64encode(input).replace(b"=", b"")
Expand Down