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

Use more augmented assignment statements (redux) #4315

Closed
jtcohen6 opened this issue Nov 22, 2021 · 2 comments
Closed

Use more augmented assignment statements (redux) #4315

jtcohen6 opened this issue Nov 22, 2021 · 2 comments
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!

Comments

@jtcohen6
Copy link
Contributor

Not sure how #4259 was deleted! I assume it was an accident, when the user account was deleted?

In any case, these are the bits that matter. More augmented assignment statements, who could be mad about that?

diff --git a/core/dbt/dataclass_schema.py b/core/dbt/dataclass_schema.py

index da95699e..309d7297 100644

--- a/core/dbt/dataclass_schema.py

+++ b/core/dbt/dataclass_schema.py

@@ -22,7 +22,7 @@ class DateTimeSerialization(SerializationStrategy):

         out = value.isoformat()

         # Assume UTC if timezone is missing

         if value.tzinfo is None:

-            out = out + "Z"

+            out += "Z"

         return out

 

     def deserialize(self, value):

diff --git a/core/dbt/graph/selector_spec.py b/core/dbt/graph/selector_spec.py

index 17c616f6..d82c2f26 100644

--- a/core/dbt/graph/selector_spec.py

+++ b/core/dbt/graph/selector_spec.py

@@ -147,7 +147,7 @@ class SelectionCriteria:

         method_name, method_arguments = cls.parse_method(dct)

         meth_name = str(method_name)

         if method_arguments:

-            meth_name = meth_name + '.' + '.'.join(method_arguments)

+            meth_name += '.' + '.'.join(method_arguments)

         dct['method'] = meth_name

         dct = {k: v for k, v in dct.items() if (v is not None and v != '')}

         if 'childrens_parents' in dct:

diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py

index d36d4a8e..7918e39a 100644

--- a/core/dbt/parser/manifest.py

+++ b/core/dbt/parser/manifest.py

@@ -389,7 +389,7 @@ class ManifestLoader:

                     block = FileBlock(self.manifest.files[file_id])

                     parser.parse_file(block)

                     # increment parsed path count for performance tracking

-                    self._perf_info.parsed_path_count = self._perf_info.parsed_path_count + 1

+                    self._perf_info.parsed_path_count += 1

             # generic tests hisotrically lived in the macros directoy but can now be nested

             # in a /generic directory under /tests so we want to process them here as well

             if 'GenericTestParser' in parser_files:

@@ -398,7 +398,7 @@ class ManifestLoader:

                     block = FileBlock(self.manifest.files[file_id])

                     parser.parse_file(block)

                     # increment parsed path count for performance tracking

-                    self._perf_info.parsed_path_count = self._perf_info.parsed_path_count + 1

+                    self._perf_info.parsed_path_count += 1

 

         self.build_macro_resolver()

         # Look at changed macros and update the macro.depends_on.macros

@@ -441,7 +441,7 @@ class ManifestLoader:

                     parser.parse_file(block, dct=dct)

                 else:

                     parser.parse_file(block)

-                project_parsed_path_count = project_parsed_path_count + 1

+                project_parsed_path_count += 1

 

             # Save timing info

             project_loader_info.parsers.append(ParserInfo(

@@ -449,7 +449,7 @@ class ManifestLoader:

                 parsed_path_count=project_parsed_path_count,

                 elapsed=time.perf_counter() - parser_start_timer

             ))

-            total_parsed_path_count = total_parsed_path_count + project_parsed_path_count

+            total_parsed_path_count += project_parsed_path_count

 

         # HookParser doesn't run from loaded files, just dbt_project.yml,

         # so do separately

@@ -469,7 +469,7 @@ class ManifestLoader:

         project_loader_info.parsed_path_count = (

             project_loader_info.parsed_path_count + total_parsed_path_count

         )

-        project_loader_info.elapsed = project_loader_info.elapsed + elapsed

+        project_loader_info.elapsed += elapsed

         self._perf_info.parsed_path_count = (

             self._perf_info.parsed_path_count + total_parsed_path_count

         )

@@ -689,7 +689,7 @@ class ManifestLoader:

         key_list.sort()

         env_var_str = ''

         for key in key_list:

-            env_var_str = env_var_str + f'{key}:{config.project_env_vars[key]}|'

+            env_var_str += f'{key}:{config.project_env_vars[key]}|'

         project_env_vars_hash = FileHash.from_contents(env_var_str)

 

         # Create a FileHash of the env_vars in the project

@@ -697,7 +697,7 @@ class ManifestLoader:

         key_list.sort()

         env_var_str = ''

         for key in key_list:

-            env_var_str = env_var_str + f'{key}:{config.profile_env_vars[key]}|'

+            env_var_str += f'{key}:{config.profile_env_vars[key]}|'

         profile_env_vars_hash = FileHash.from_contents(env_var_str)

 

         # Create a FileHash of the profile file

diff --git a/test/integration/047_dbt_ls_test/test_ls.py b/test/integration/047_dbt_ls_test/test_ls.py

index 9ab815c7..7fcc47e7 100644

--- a/test/integration/047_dbt_ls_test/test_ls.py

+++ b/test/integration/047_dbt_ls_test/test_ls.py

@@ -42,7 +42,7 @@ class TestStrictUndefined(DBTIntegrationTest):

         log_manager.stdout_console()

         full_args = ['ls']

         if args is not None:

-            full_args = full_args + args

+            full_args += args

 

         result = self.run_dbt(args=full_args, expect_pass=expect_pass)

 

diff --git a/test/unit/test_macro_calls.py b/test/unit/test_macro_calls.py

index 4c2837be..bfa29869 100644

--- a/test/unit/test_macro_calls.py

+++ b/test/unit/test_macro_calls.py

@@ -47,6 +47,6 @@ class MacroCalls(unittest.TestCase):

         for macro_string in self.macro_strings:

             possible_macro_calls = statically_extract_macro_calls(macro_string, ctx)

             self.assertEqual(self.possible_macro_calls[index], possible_macro_calls)

-            index = index + 1

+            index += 1
@jtcohen6 jtcohen6 added enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors! labels Nov 22, 2021
@sarah-weatherbee
Copy link
Contributor

I'll take this!

sarah-weatherbee added a commit to sarah-weatherbee/dbt-core that referenced this issue Nov 23, 2021
emmyoop pushed a commit that referenced this issue Nov 27, 2021
* adds additional augmented assignment statements (#4315)

* Per PR comments, revised CHANGELOG.md to note change and contributor info
@jtcohen6
Copy link
Contributor Author

Resolved by #4331

iknox-fa pushed a commit that referenced this issue Feb 8, 2022
* adds additional augmented assignment statements (#4315)

* Per PR comments, revised CHANGELOG.md to note change and contributor info

automatic commit by git-black, original commits:
  d80646c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

No branches or pull requests

2 participants