Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply more assorted Pyugrade suggestions #4125

Merged
merged 12 commits into from
Jan 5, 2024

Commits on Jan 5, 2024

  1. Configuration menu
    Copy the full SHA
    0f08db8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ac3bf62 View commit details
    Browse the repository at this point in the history
  3. io.open() → open()

    In Python 3, io.open() is an alias for the builtin open() function.
    
    https://docs.python.org/3/library/io.html#io.open
    
    This is a suggestion from pyupgrade:
    https://github.com/asottile/pyupgrade#open-alias
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    af41360 View commit details
    Browse the repository at this point in the history
  4. Simplify super() calls

    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    bba79a0 View commit details
    Browse the repository at this point in the history
  5. Don't cast string literals with str()

    Fixed by running `ruff --select UP018 --fix .`:
    UP018 [*] Unnecessary `str` call (rewrite as a literal)
    
    Original suggestions from pyupgrade:
    https://github.com/asottile/pyupgrade#forced-strnative-literals
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    1ddffe4 View commit details
    Browse the repository at this point in the history
  6. os.error → OSError

    This is an alias for the built-in OSError exception:
    https://docs.python.org/3/library/os.html#os.error
    
    Fixed by running `ruff --select UP024 --fix .`:
    UP024 [*] Replace aliased errors with `OSError`
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    8da1688 View commit details
    Browse the repository at this point in the history
  7. Use capture_output

    In Python ≥ 3.7, `capture_output` can be used instead of `stdout=PIPE` / `stderr=PIPE`.
    
    Fixed by running `ruff --select UP022 --fix --unsafe-fixes .`:
    UP022 Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output`
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    a628dc5 View commit details
    Browse the repository at this point in the history
  8. Remove extraneous pair of prentheses

    Fixed by running `ruff --select UP034 --fix .`:
    UP034 [*] Avoid extraneous parentheses
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    b5f07c9 View commit details
    Browse the repository at this point in the history
  9. Get rid of one last coding: utf-8

    In Python 3, the source encodign is implict, UTF-8 by default.
    
    This is a suggestion from pyupgrade:
    https://github.com/asottile/pyupgrade#-coding--comment
    
    Fixed by running `ruff --select UP009 --fix .`:
    UP009 [*] UTF-8 encoding declaration is unnecessary
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    86bb681 View commit details
    Browse the repository at this point in the history
  10. Use byte literals instead of .encode()

    This is a suggestion from pyupgrade:
    https://github.com/asottile/pyupgrade#encode-to-bytes-literals
    
    Fixed by running `ruff --select UP012 --fix .`:
    UP012 [*] Unnecessary call to `encode` as UTF-8
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    5ba5c2e View commit details
    Browse the repository at this point in the history
  11. Use generator instead of list

    Fixed by running `ruff --select UP027 --fix .`:
    UP027 [*] Replace unpacked list comprehension with a generator expression
    DimitriPapadopoulos authored and abravalheri committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    a142991 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    07774d9 View commit details
    Browse the repository at this point in the history