areski / python-nvd3

Python Wrapper for NVD3 - It's time for beautiful charts
Other
662 stars 192 forks source link

Increase the usage of augmented assignment statements #173

Closed elfring closed 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/nvd3/lineChart.py b/nvd3/lineChart.py
index d832d8e..d4731a7 100644
--- a/nvd3/lineChart.py
+++ b/nvd3/lineChart.py
@@ -67,7 +67,7 @@ class lineChart(TemplateMixin, NVD3Chart):
                     chart.showLegend(true);
                         function get_am_pm(d){
                     if (d > 12) {
-                        d = d - 12; return (String(d) + 'PM');
+                        d -= 12; return (String(d) + 'PM');
                     }
                     else {
                         return (String(d) + 'AM');
diff --git a/nvd3/multiChart.py b/nvd3/multiChart.py
index b4566ae..79ce38a 100644
--- a/nvd3/multiChart.py
+++ b/nvd3/multiChart.py
@@ -64,7 +64,7 @@ Axis": 2}];

         function get_am_pm(d){
             if (d > 12) {
-                d = d - 12; return (String(d) + 'PM');
+                d -= 12; return (String(d) + 'PM');
             }
             else {
                 return (String(d) + 'AM');
diff --git a/nvd3/translator.py b/nvd3/translator.py
index ffde2c2..df672f2 100644
--- a/nvd3/translator.py
+++ b/nvd3/translator.py
@@ -48,10 +48,10 @@ class Function(object):

     def __call__(self, *args):
         if not args:
-            self._calls[-1] = self._calls[-1] + '()'
+            self._calls[-1] += '()'
         else:
             arguments = ','.join([str(arg) for arg in args])
-            self._calls[-1] = self._calls[-1] + '(%s)' % (arguments,)
+            self._calls[-1] += '(%s)' % (arguments,)
         return self
areski commented 2 years ago

Those type of PRs are just consuming time from maintainers and actually bring zero value to the project

elfring commented 2 years ago

:thought_balloon: Will the software development attention eventually grow for the application of functionality which became generally available with Python 2?