Open pixeebot[bot] opened 3 months ago
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information
Processing PR updates...
Unable to locate .performanceTestingBot config file
Check out the playback for this Pull Request here.
Thanks @pixeebot[bot] for opening this PR!
For COLLABORATOR only :
To add labels, comment on the issue
/label add label1,label2,label3
To remove labels, comment on the issue
/label remove label1,label2,label3
Hello @pixeebot[bot]! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
himatpy/LIS/utils.py
:Line 17:80: E501 line too long (119 > 79 characters)
[!IMPORTANT]
Review skipped
Bot user detected.
To trigger a single review, invoke the
@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
PR Details of @pixeebot[bot] in NASA-Planetary-Science-HiMAT : | OPEN | CLOSED | TOTAL |
---|---|---|---|
1 | 2 | 3 |
I'm confident in this change, but I'm not a maintainer of this project. Do you see any reason not to merge it?
If this change was not helpful, or you have suggestions for improvements, please let me know!
Using mutable values for default arguments is not a safe practice. Look at the following very simple example code:
The function
foo
doesn't do anything very interesting; it just prints the result ofx
appended toy
. Naively we might expect this to simply print an array containing onlyx
every timefoo
is called, like this:But that's not what happens!
The value of
y
is preserved between calls! This might seem surprising, and it is. It's due to the way that scope works for function arguments in Python.The result is that any default argument value will be preserved between function calls. This is problematic for mutable types, including things like
list
,dict
, andset
.Relying on this behavior is unpredictable and generally considered to be unsafe. Most of us who write code like this were not anticipating the surprising behavior, so it's best to fix it.
Our codemod makes an update that looks like this:
Using
None
is a much safer default. The new code checks ifNone
is passed, and if so uses an emptylist
for the value ofy
. This will guarantee consistent and safe behavior between calls.I have additional improvements ready for this repo! If you want to see them, leave the comment:
... and I will open a new PR right away!
🧚🤖 Powered by Pixeebot
Feedback | Community | Docs | Codemod ID: pixee:python/fix-mutable-params