Skip to content

Using augmented assignements (in-place operators) where possible#2274

Merged
Avasam merged 6 commits intomhammond:mainfrom
Avasam:augmented-assignements
Jun 4, 2024
Merged

Using augmented assignements (in-place operators) where possible#2274
Avasam merged 6 commits intomhammond:mainfrom
Avasam:augmented-assignements

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Jun 1, 2024

Most were found thanks to https://docs.astral.sh/ruff/rules/non-augmented-assignment/

Then, since Ruff/PLR6104 doesn't support associative operations (yet astral-sh/ruff#11656), I used the following regex to find more:
(\w+?) = (\(\n\s+)\1 ([\+\-\*/\|&%~]|>>|<<|\*\*|//) --> $1 $3= (
(\w+?) = \1 ([\+\-\*/\|&%~]|>>|<<|\*\*|//) --> $1 $2=
(\w+?) = f('|")\{\1\} --> $1 += f$2

Then manually reviewed the whole thing.

@Avasam Avasam merged commit 60d7236 into mhammond:main Jun 4, 2024
@Avasam Avasam deleted the augmented-assignements branch June 4, 2024 17:39
clin1234 pushed a commit to clin1234/pywin32 that referenced this pull request Jun 7, 2024
Avasam added a commit to Avasam/pywin32 that referenced this pull request Dec 31, 2024
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.

2 participants