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

Code Quality Improvements: Resolve Ruff Linting Warnings #161

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RupeshMangalam21
Copy link
Contributor

@RupeshMangalam21 RupeshMangalam21 commented Feb 8, 2025

Changes

Testing

  • Run test suite
  • Verify no functionality changes
  • Check error handling paths

Checklist

  • Code follows project style guide
  • Documentation has been updated
  • All tests pass
  • No new warnings from Ruff

Notes

This PR addresses the following Ruff warning categories:

  • D100-D417: Docstring formatting
  • E501: Line length
  • B006, B008: Mutable defaults
  • B904: Exception handling

@RupeshMangalam21
Copy link
Contributor Author

Hey, @Sukh-P , while resolving the errors, i have come across this piece of code -

max_dropout and first_forecast_step have default values set to pd.Timedelta(0). Since pd.Timedelta creates a new object each time, this is technically safe in Python because each call gets a new instance. However, Ruff's B008 flags any function call in defaults, regardless of mutability. So to comply with the linter, we need to replace these defaults with None and set them inside the function.

Something like this - Changing max_dropout: pd.Timedelta = pd.Timedelta(0) to max_dropout: pd.Timedelta | None = None

would this be appropriate?

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.

Code Quality Improvements: Address Ruff Linting Warnings
1 participant