feast icon indicating copy to clipboard operation
feast copied to clipboard

Increase the usage of augmented assignment statements

Open elfring opened this issue 4 years ago • 2 comments

: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/sdk/python/feast/infra/offline_stores/file.py b/sdk/python/feast/infra/offline_stores/file.py
index bce32e92..015f85c6 100644
--- a/sdk/python/feast/infra/offline_stores/file.py
+++ b/sdk/python/feast/infra/offline_stores/file.py
@@ -215,7 +215,7 @@ class FileOfflineStore(OfflineStore):
                 right_entity_key_sort_columns = right_entity_key_columns
                 if created_timestamp_column:
                     # If created_timestamp is available, use it to dedupe deterministically
-                    right_entity_key_sort_columns = right_entity_key_sort_columns + [
+                    right_entity_key_sort_columns += [
                         created_timestamp_column
                     ]
 
diff --git a/sdk/python/feast/infra/provider.py b/sdk/python/feast/infra/provider.py
index 2bf8f632..e9ca3eb8 100644
--- a/sdk/python/feast/infra/provider.py
+++ b/sdk/python/feast/infra/provider.py
@@ -262,7 +262,7 @@ def _get_column_names(
     # We need to exclude join keys and timestamp columns from the list of features, after they are mapped to
     # their final column names via the `field_mapping` field of the source.
     _feature_names = set(feature_names) - set(join_keys)
-    _feature_names = _feature_names - {event_timestamp_column, created_timestamp_column}
+    _feature_names -= {event_timestamp_column, created_timestamp_column}
     feature_names = list(_feature_names)
     return (
         join_keys,
diff --git a/sdk/python/feast/infra/utils/aws_utils.py b/sdk/python/feast/infra/utils/aws_utils.py
index 6211c75e..db267e91 100644
--- a/sdk/python/feast/infra/utils/aws_utils.py
+++ b/sdk/python/feast/infra/utils/aws_utils.py
@@ -301,7 +301,7 @@ def download_s3_directory(s3_resource, bucket: str, key: str, local_dir: str):
     """ Download the S3 directory to a local disk """
     bucket_obj = s3_resource.Bucket(bucket)
     if key != "" and not key.endswith("/"):
-        key = key + "/"
+        key += "/"
     for obj in bucket_obj.objects.filter(Prefix=key):
         local_file_path = local_dir + "/" + obj.key[len(key) :]
         local_file_dir = os.path.dirname(local_file_path)
@@ -313,7 +313,7 @@ def delete_s3_directory(s3_resource, bucket: str, key: str):
     """ Delete S3 directory recursively """
     bucket_obj = s3_resource.Bucket(bucket)
     if key != "" and not key.endswith("/"):
-        key = key + "/"
+        key += "/"
     for obj in bucket_obj.objects.filter(Prefix=key):
         obj.delete()
 
diff --git a/sdk/python/tests/integration/e2e/test_universal_e2e.py b/sdk/python/tests/integration/e2e/test_universal_e2e.py
index 7e72e49d..5e14cde9 100644
--- a/sdk/python/tests/integration/e2e/test_universal_e2e.py
+++ b/sdk/python/tests/integration/e2e/test_universal_e2e.py
@@ -16,7 +16,7 @@ from tests.integration.feature_repos.universal.feature_views import driver_featu
 @pytest.mark.parametrize("infer_features", [True, False])
 def test_e2e_consistency(environment, e2e_data_sources, infer_features):
     fs = environment.feature_store
-    fs.config.project = fs.config.project + str(infer_features)
+    fs.config.project += str(infer_features)
     df, data_source = e2e_data_sources
     fv = driver_feature_view(data_source=data_source, infer_features=infer_features)
 

elfring avatar Nov 21 '21 20:11 elfring

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 25 '22 22:05 stale[bot]

I find that the rationale of the Python enhancement proposal 203 (from 2000-07-13) can indicate also motivation for another bit of collateral evolution. :thinking:

elfring avatar May 26 '22 07:05 elfring

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 20 '22 23:12 stale[bot]

:crystal_ball: Under which circumstances will development interests grow for the shown change possibilities?

elfring avatar Dec 21 '22 08:12 elfring