From 8bf6497d56ccc7c96f68155bb98600f22f9cead0 Mon Sep 17 00:00:00 2001 From: Lucas Fonseca Date: Thu, 11 Aug 2022 11:15:53 -0300 Subject: [PATCH] Update black due dependencies issue --- examples/add_partitions_if_not_exists.py | 8 +++-- examples/add_partitions_to_table.py | 8 +++-- .../hive_metastore_client.py | 4 ++- requirements.lint.txt | 2 +- .../test_hive_metastore_client.py | 32 ++++++++++++++----- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/examples/add_partitions_if_not_exists.py b/examples/add_partitions_if_not_exists.py index 29c894b..aceeab1 100644 --- a/examples/add_partitions_if_not_exists.py +++ b/examples/add_partitions_if_not_exists.py @@ -11,10 +11,14 @@ # values should be passed in the same hierarchical order of the partitions partition_list = [ PartitionBuilder( - values=["2020", "12", "13"], db_name=DATABASE_NAME, table_name=TABLE_NAME, + values=["2020", "12", "13"], + db_name=DATABASE_NAME, + table_name=TABLE_NAME, ).build(), PartitionBuilder( - values=["2020", "12", "14"], db_name=DATABASE_NAME, table_name=TABLE_NAME, + values=["2020", "12", "14"], + db_name=DATABASE_NAME, + table_name=TABLE_NAME, ).build(), ] diff --git a/examples/add_partitions_to_table.py b/examples/add_partitions_to_table.py index 258381f..267b271 100644 --- a/examples/add_partitions_to_table.py +++ b/examples/add_partitions_to_table.py @@ -11,10 +11,14 @@ # values should be passed in the same hierarchical order of the partitions partition_list = [ PartitionBuilder( - values=["2020", "12", "16"], db_name=DATABASE_NAME, table_name=TABLE_NAME, + values=["2020", "12", "16"], + db_name=DATABASE_NAME, + table_name=TABLE_NAME, ).build(), PartitionBuilder( - values=["2020", "12", "17"], db_name=DATABASE_NAME, table_name=TABLE_NAME, + values=["2020", "12", "17"], + db_name=DATABASE_NAME, + table_name=TABLE_NAME, ).build(), ] diff --git a/hive_metastore_client/hive_metastore_client.py b/hive_metastore_client/hive_metastore_client.py index 42bb338..666a666 100644 --- a/hive_metastore_client/hive_metastore_client.py +++ b/hive_metastore_client/hive_metastore_client.py @@ -376,7 +376,9 @@ def get_partition_values_from_table( if partition_keys: partition_values_response = self.get_partition_values( PartitionValuesRequest( - dbName=db_name, tblName=table_name, partitionKeys=partition_keys, + dbName=db_name, + tblName=table_name, + partitionKeys=partition_keys, ) ) partitions = [ diff --git a/requirements.lint.txt b/requirements.lint.txt index 0b1ebce..f9710f2 100644 --- a/requirements.lint.txt +++ b/requirements.lint.txt @@ -1,4 +1,4 @@ -black==19.10b0 +black==22.3.0 flake8==3.7.9 flake8-docstrings==1.5.0 mypy==0.782 \ No newline at end of file diff --git a/tests/unit/hive_metastore_client/test_hive_metastore_client.py b/tests/unit/hive_metastore_client/test_hive_metastore_client.py index 37de13c..9c590e5 100644 --- a/tests/unit/hive_metastore_client/test_hive_metastore_client.py +++ b/tests/unit/hive_metastore_client/test_hive_metastore_client.py @@ -380,7 +380,9 @@ def test_format_partitions_location( @mock.patch.object(HiveMetastoreClient, "create_database") def test_create_database_if_not_exists_with_nonexistent_database( - self, mocked_create_database, hive_metastore_client, + self, + mocked_create_database, + hive_metastore_client, ): # arrange mocked_database_obj = Mock() @@ -393,7 +395,9 @@ def test_create_database_if_not_exists_with_nonexistent_database( @mock.patch.object(HiveMetastoreClient, "create_database") def test_create_database_if_not_exists_with_existent_database( - self, mocked_create_database, hive_metastore_client, + self, + mocked_create_database, + hive_metastore_client, ): # arrange mocked_database_obj = Mock() @@ -427,7 +431,9 @@ def test_create_external_table(self, mocked_create_table, hive_metastore_client) @mock.patch.object(HiveMetastoreClient, "get_table", return_value=None) def test_get_partition_keys_objects_with_invalid_table( - self, mocked_get_table, hive_metastore_client, + self, + mocked_get_table, + hive_metastore_client, ): # arrange table_name = "table_name" @@ -446,7 +452,9 @@ def test_get_partition_keys_objects_with_invalid_table( @mock.patch.object(HiveMetastoreClient, "get_table") def test_get_partition_keys_objects_with_not_partitioned_table( - self, mocked_get_table, hive_metastore_client, + self, + mocked_get_table, + hive_metastore_client, ): # arrange table_name = "table_name" @@ -469,7 +477,9 @@ def test_get_partition_keys_objects_with_not_partitioned_table( @mock.patch.object(HiveMetastoreClient, "get_table") def test_get_partition_keys_objects_with_partitioned_table( - self, mocked_get_table, hive_metastore_client, + self, + mocked_get_table, + hive_metastore_client, ): # arrange table_name = "table_name" @@ -495,7 +505,9 @@ def test_get_partition_keys_objects_with_partitioned_table( HiveMetastoreClient, "get_partition_keys_objects", return_value=[] ) def test_get_partition_keys_names_with_invalid_or_not_partitioned_table( - self, mocked_get_partition_keys_objects, hive_metastore_client, + self, + mocked_get_partition_keys_objects, + hive_metastore_client, ): # arrange table_name = "table_name" @@ -516,7 +528,9 @@ def test_get_partition_keys_names_with_invalid_or_not_partitioned_table( HiveMetastoreClient, "get_partition_keys_objects", return_value=[] ) def test_get_partition_keys_names_with_partitioned_table( - self, mocked_get_partition_keys_objects, hive_metastore_client, + self, + mocked_get_partition_keys_objects, + hive_metastore_client, ): # arrange table_name = "table_name" @@ -654,7 +668,9 @@ def test_get_partition_values_from_table_with_non_partitioned_table( mocked_get_partition_keys_objects.return_value = [] expected_partition_values_request = PartitionValuesRequest( - dbName=database_name, tblName=table_name, partitionKeys=[], + dbName=database_name, + tblName=table_name, + partitionKeys=[], ) mocked_get_partition_values.side_effect = [TTransportException()]