Change suggestion to Python code comments #527

Closed
opened 2026-01-29 20:45:14 +00:00 by claunia · 1 comment
Owner

Originally created by @MikeB2019x on GitHub (Nov 1, 2024).

Currently the code for python here does not indicate what int values are appropriate for entry. Suggest the description for the mode parameter be altered from:

# Compress a byte string.
def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0):
    """Compress a byte string.

    Args:
      string (bytes): The input data.
      mode (int, optional): The compression mode can be MODE_GENERIC (default),
        MODE_TEXT (for UTF-8 format text input) or MODE_FONT (for WOFF 2.0).

to:

# Compress a byte string.
def compress(string, mode=0, quality=11, lgwin=22, lgblock=0):
    """Compress a byte string.

    Args:
      string (bytes): The input data.
      mode (int, optional): The compression mode can be of value 0 for  generic input (MODE_GENERIC),
      of value 1 for UTF-8 format text input (MODE_TEXT ) or of value 2 for WOFF 2.0 font data (MODE_FONT).
      Default is 0.

The integer values are drawn from the commentary in the `

Originally created by @MikeB2019x on GitHub (Nov 1, 2024). Currently the code for python [here](https://github.com/google/brotli/blob/master/python/brotli.py) does not indicate what `int` values are appropriate for entry. Suggest the description for the mode parameter be altered from: ``` # Compress a byte string. def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0): """Compress a byte string. Args: string (bytes): The input data. mode (int, optional): The compression mode can be MODE_GENERIC (default), MODE_TEXT (for UTF-8 format text input) or MODE_FONT (for WOFF 2.0). ``` to: ``` # Compress a byte string. def compress(string, mode=0, quality=11, lgwin=22, lgblock=0): """Compress a byte string. Args: string (bytes): The input data. mode (int, optional): The compression mode can be of value 0 for generic input (MODE_GENERIC), of value 1 for UTF-8 format text input (MODE_TEXT ) or of value 2 for WOFF 2.0 font data (MODE_FONT). Default is 0. ``` The integer values are drawn from the commentary in the `
Author
Owner

@eustas commented on GitHub (Nov 19, 2024):

Sure, will update soon. Thanks for reporting.

@eustas commented on GitHub (Nov 19, 2024): Sure, will update soon. Thanks for reporting.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#527