Skip to content

Conversation

@yurekami
Copy link

Summary

This PR fixes Python code style issues to follow PEP 8 best practices.

Changes

  1. Use assert not causal instead of assert causal == False (flash_mla_interface.py)

    • PEP 8 E712: comparison to False should be not expr
    • Also improved the error message clarity
  2. Catch specific exceptions instead of bare Exception (setup.py)

    • Changed except Exception to except (subprocess.CalledProcessError, FileNotFoundError, OSError)
    • Added explanatory comment for the fallback behavior

Before/After

# Before
assert causal == False, "causal must be `false` if sparse attention is enabled."

# After  
assert not causal, "causal must be False when sparse attention is enabled (indices provided)"
# Before
except Exception as _:

# After
except (subprocess.CalledProcessError, FileNotFoundError, OSError):
    # Fallback to timestamp if git is not available or not in a git repo

Test plan

  • Code passes Python syntax check
  • No functional changes

🤖 Generated with Claude Code

Changes:
- Use `assert not causal` instead of `assert causal == False` (E712)
- Catch specific exceptions instead of bare `Exception` in setup.py
- Add comment explaining the fallback behavior for version detection

These changes improve code quality and follow Python best practices.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant