Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert five assignment statements to augmented source code #287

Open
elfring opened this issue Nov 24, 2021 · 0 comments
Open

Convert five assignment statements to augmented source code #287

elfring opened this issue Nov 24, 2021 · 0 comments

Comments

@elfring
Copy link

elfring commented Nov 24, 2021

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

diff --git a/bin/q.py b/bin/q.py
index 716e783..9ec549b 100755
--- a/bin/q.py
+++ b/bin/q.py
@@ -1102,7 +1102,7 @@ class TableColumnInferer(object):
                         len(self.header_row), self.column_count))
                 elif self.mode in ['relaxed']:
                     # in relaxed mode, add columns to fill the missing ones
-                    self.header_row = self.header_row + \
+                    self.header_row += \
                         ['c%s' % (x + len(self.header_row) + 1)
                          for x in range(self.column_count - len(self.header_row))]
             elif len(self.header_row) > self.column_count:
@@ -1442,7 +1442,7 @@ class DelimitedFileReader(object):
             else:
                 for file_name,is_first_line,col_vals in csv_reader:
                     if is_first_line:
-                        self.file_number = self.file_number + 1
+                        self.file_number += 1
                     self.lines_read += 1
                     yield file_name,self.file_number,is_first_line,col_vals
         except ColumnMaxLengthLimitExceededException as e:
@@ -2262,7 +2262,7 @@ class TableCreator(object):
         # in all non strict mode, we add dummy data to missing columns
 
         if actual_col_count < expected_col_count:
-            col_vals = col_vals + \
+            col_vals += \
                 [None for x in range(expected_col_count - actual_col_count)]
 
         # in relaxed mode, we merge all extra columns to the last column value
diff --git a/test/test_suite.py b/test/test_suite.py
index f722e8f..93c7dff 100755
--- a/test/test_suite.py
+++ b/test/test_suite.py
@@ -409,7 +409,7 @@ class SaveToSqliteTests(AbstractQTestCase):
 
         tables_as_str = " left join ".join(["%s/%s" % (tmpfolder,x) for x in filename_list])
 
-        tables_as_str = tables_as_str + ' left join %s/non_existent_table' % (tmpfolder)
+        tables_as_str += ' left join %s/non_existent_table' % (tmpfolder)
 
         cmd = '%s -H "select count(*) from %s" -c 1 -S %s' % (Q_EXECUTABLE,tables_as_str,output_sqlite_file)
         retcode, o, e = run_command(cmd)
@@ -5627,7 +5627,7 @@ class BenchmarkTests(AbstractQTestCase):
         def generate_q_cmd(data_filename, line_count, column_count):
             Q_BENCHMARK_ADDITIONAL_PARAMS = os.environ.get('Q_BENCHMARK_ADDITIONAL_PARAMS') or ''
             additional_params = ''
-            additional_params = additional_params + ' ' + Q_BENCHMARK_ADDITIONAL_PARAMS
+            additional_params += ' ' + Q_BENCHMARK_ADDITIONAL_PARAMS
             return '{} -d , {} "select count(*) from {}"'.format(Q_EXECUTABLE,additional_params, data_filename)
         self._perform_test_performance_matrix(Q_BENCHMARK_NAME,generate_q_cmd)
 
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

No branches or pull requests

1 participant