Skip to content

RF: Applied augmented assignment (x += y rather than x = x + y) where applicable (#4385)#7114

Merged
TEParsons merged 1 commit intopsychopy:devfrom
bschiller8:Open-source-Contribution
Apr 16, 2025
Merged

RF: Applied augmented assignment (x += y rather than x = x + y) where applicable (#4385)#7114
TEParsons merged 1 commit intopsychopy:devfrom
bschiller8:Open-source-Contribution

Conversation

@bschiller8
Copy link
Copy Markdown
Contributor

This PR refactors multiple instances of simple assignments to use augmented assignment statements (+=, -=, *=, etc.) where applicable. This improves code readability and efficiency.

Changes Made:
Replaced mouseWheelRel = mouseWheelRel + numpy.array([scroll_x, scroll_y]) with mouseWheelRel += numpy.array([scroll_x, scroll_y]) in psychopy/event.py.
Optimized scrX = scrX + (self.size[0] / 2.) to scrX += self.size[0] / 2. in psychopy/visual/window.py.
Updated frameN = frameN + 1 to frameN += 1 in psychopy/tests/data/correctScript/python/correctNoiseStimComponent.py.

Issue Reference:
Closes #4385

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 49.89%. Comparing base (ca48745) to head (22e1b4b).
Report is 251 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #7114   +/-   ##
=======================================
  Coverage   49.89%   49.89%           
=======================================
  Files         346      346           
  Lines       64012    64004    -8     
=======================================
+ Hits        31936    31937    +1     
+ Misses      32076    32067    -9     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TEParsons TEParsons changed the title RF: Applied augmented assignment where applicable (#4385) RF: Applied augmented assignment (x += y rather than x = x + y) where applicable (#4385) Feb 19, 2025
@mdcutone mdcutone self-assigned this Feb 28, 2025
@mdcutone mdcutone self-requested a review February 28, 2025 17:57
@TEParsons TEParsons merged commit ca77473 into psychopy:dev Apr 16, 2025
7 checks passed
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.

Increase the usage of augmented assignment statements

3 participants