Skip to content

Commit

Permalink
Update black due dependencies issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Fonseca committed Aug 11, 2022
1 parent fe92ca1 commit 8bf6497
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
8 changes: 6 additions & 2 deletions examples/add_partitions_if_not_exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]

Expand Down
8 changes: 6 additions & 2 deletions examples/add_partitions_to_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]

Expand Down
4 changes: 3 additions & 1 deletion hive_metastore_client/hive_metastore_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion requirements.lint.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==19.10b0
black==22.3.0
flake8==3.7.9
flake8-docstrings==1.5.0
mypy==0.782
32 changes: 24 additions & 8 deletions tests/unit/hive_metastore_client/test_hive_metastore_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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()]
Expand Down

0 comments on commit 8bf6497

Please sign in to comment.