celery / kombu

Messaging library for Python.
http://kombu.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
2.85k stars 926 forks source link

Use another augmented assignment statement #1416

Open elfring opened 2 years ago

elfring commented 2 years ago

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/kombu/common.py b/kombu/common.py
index 08bc1aff..6b44d94c 100644
--- a/kombu/common.py
+++ b/kombu/common.py
@@ -399,7 +399,7 @@ class QoS:
         """
         with self._mutex:
             if self.value:
-                self.value = self.value + max(n, 0)
+                self.value += max(n, 0)
         return self.value

     def decrement_eventually(self, n=1):
open-collective-bot[bot] commented 2 years ago

Hey @elfring :wave:, Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider backing us - every little helps!

We also offer priority support for our sponsors. If you require immediate assistance please consider sponsoring us.

matusvalo commented 2 years ago

@elfring thank you issue. Definitely make sense. PR is highly welcome.

elfring commented 2 years ago

:thought_balloon: How will the chances evolve to adjust one assignment statement directly?