Replace non-idiomatic None comparison in pytorch/benchmark/bisection....
Summary:
- Replace non-idiomatic None comparison in pytorch/benchmark/bisection.py line 526 changing "if mid == None:" to "if mid is None:" per PEP 8 style guidelines.
- Remove empty finally clause with just pass at lines 20-21 in testinfra/utils/tar_utils.py in the TarFile context manager since it serves no purpose.
- Remove redundant bare pass statement at line 65 in servicerouter/canary/scuba_logger.py in the log_health_check_response_to_scuba function after the except FBUrlError block since the except already contains a logging statement.
AI Review:
- security: PASSED (1.00) — All three changes are purely cosmetic/style cleanups with no security impact:
- quality: PASSED (0.95) — All three changes are correct and safe:
1. **`bisection.py`**: `if mid == None:` → `if mid is None:` — Standard PEP 8 fix. `get_mid_commit` returns a commit or `None`, and identity comparison with `is` is the correct way to check for `None`. No behavioral change since `None` is a singleton.
2. **`scuba_logger.py`**: Removing redundant `pass` after `logging.debug(...)` in the `except FBUrlError` block — The `pass` is completely redundant since the `logging.debug` call already serves as the except block's body. No behavioral change.
3. **`tar_utils.py`**: Removing empty `try/finally: pass` wrapper — The `finally: pass` does nothing. The `with tarfile.open(...)` context manager already handles cleanup. Callers (`try_extract`, `try_bundle`, `try_bundle_with_arcnames`) all use `TarFile` the same way and are unaffected. No behavioral change.
All changes are minimal, idiomatic improvements with no impact on callers or dependent code.
- task_solution: PASSED (0.95) — All three changes are correct, minimal, and solve exactly what was requested. No behavioral changes, no regressions, no broken callers.
Reviewed By: dtolnay
Differential Revision: D96806427
fbshipit-source-id: 5ab8ffd28ca5379d3bc07f91b688874eb0a57b03