Skip to content

Replaced mutable data structures for default arguments (B006)#9462

Merged
jrbourbeau merged 2 commits intodask:mainfrom
lukeconibear:9369-precommit-flake8bugbear-b006
Sep 6, 2022
Merged

Replaced mutable data structures for default arguments (B006)#9462
jrbourbeau merged 2 commits intodask:mainfrom
lukeconibear:9369-precommit-flake8bugbear-b006

Conversation

@lukeconibear
Copy link
Copy Markdown
Contributor

@lukeconibear lukeconibear commented Sep 4, 2022

Summary of changes in this PR

  • One of the individual PRs per warning from flake8-bugbear that is required for Added flake8-bugbear to pre-commit hooks #9457.
    • B006: Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
    • Solution from here.
    • Ran on whole repository using: flake8 --select B006

General

  • Tests added / passed
  • Passes pre-commit run --all-files

@GPUtester
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

Admins can comment ok to test to allow this one PR to run or add to allowlist to allow all future PRs from the same author to run.

@phobson phobson requested a review from ian-r-rose September 6, 2022 15:07
@jrbourbeau jrbourbeau requested review from jrbourbeau and removed request for ian-r-rose September 6, 2022 15:29
Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lukeconibear! This is in

@jrbourbeau jrbourbeau merged commit ef34664 into dask:main Sep 6, 2022
@lukeconibear
Copy link
Copy Markdown
Contributor Author

Great, thanks very much!

@lukeconibear lukeconibear deleted the 9369-precommit-flake8bugbear-b006 branch September 6, 2022 18:14
@phobson phobson added the hygiene Improve code quality and reduce maintenance overhead label Sep 9, 2022
tomwhite added a commit to cubed-dev/cubed that referenced this pull request Apr 16, 2024
tomwhite added a commit to cubed-dev/cubed that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array dataframe hygiene Improve code quality and reduce maintenance overhead io

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants