Skip to content

Commit 3b987d9

Browse files
authoredAug 3, 2022
ARROW-17282: [Python] flake8 update fails linter CI (apache#13778)
Authored-by: Jacob Wujciak-Jens <jacob@wujciak.de> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent fc06dae commit 3b987d9

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed
 

‎.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repos:
3737
entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -
3838
exclude: ^dev/.*$
3939
- repo: https://github.com/pycqa/flake8
40-
rev: 4.0.1
40+
rev: 5.0.3
4141
hooks:
4242
- id: flake8
4343
name: Python Format

‎dev/archery/archery/utils/command.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
def default_bin(name, default):
27-
assert(default)
27+
assert default
2828
env_name = "ARCHERY_{0}_BIN".format(default.upper())
2929
return name if name else os.environ.get(env_name, default)
3030

‎python/pyarrow/parquet/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ def _check_filters(filters, check_null_strings=True):
109109
return filters
110110

111111

112-
_DNF_filter_doc = """Predicates are expressed in disjunctive normal form (DNF), like
113-
``[[('x', '=', 0), ...], ...]``. DNF allows arbitrary boolean logical
112+
_DNF_filter_doc = """Predicates are expressed in disjunctive normal form (DNF),
113+
like ``[[('x', '=', 0), ...], ...]``. DNF allows arbitrary boolean logical
114114
combinations of single column predicates. The innermost tuples each
115115
describe a single column predicate. The list of inner predicates is
116-
interpreted as a conjunction (AND), forming a more selective and
117-
multiple column predicate. Finally, the most outer list combines these
118-
filters as a disjunction (OR).
116+
interpreted as a conjunction (AND), forming a more selective and multiple
117+
column predicate. Finally, the most outer list combines these filters as a
118+
disjunction (OR).
119119
120120
Predicates may also be passed as List[Tuple]. This form is interpreted
121121
as a single conjunction. To express OR in predicates, one must

‎python/pyarrow/tests/parquet/encryption.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121

2222
class InMemoryKmsClient(pe.KmsClient):
23-
"""This is a mock class implementation of KmsClient, built for testing only.
23+
"""This is a mock class implementation of KmsClient, built for testing
24+
only.
2425
"""
2526

2627
def __init__(self, config):

‎python/pyarrow/tests/parquet/test_encryption.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def write_encrypted_parquet(path, table, encryption_config,
109109
kms_connection_config, crypto_factory):
110110
file_encryption_properties = crypto_factory.file_encryption_properties(
111111
kms_connection_config, encryption_config)
112-
assert(file_encryption_properties is not None)
112+
assert file_encryption_properties is not None
113113
with pq.ParquetWriter(
114114
path, table.schema,
115115
encryption_properties=file_encryption_properties) as writer:
@@ -120,13 +120,13 @@ def read_encrypted_parquet(path, decryption_config,
120120
kms_connection_config, crypto_factory):
121121
file_decryption_properties = crypto_factory.file_decryption_properties(
122122
kms_connection_config, decryption_config)
123-
assert(file_decryption_properties is not None)
123+
assert file_decryption_properties is not None
124124
meta = pq.read_metadata(
125125
path, decryption_properties=file_decryption_properties)
126-
assert(meta.num_columns == 3)
126+
assert meta.num_columns == 3
127127
schema = pq.read_schema(
128128
path, decryption_properties=file_decryption_properties)
129-
assert(len(schema.names) == 3)
129+
assert len(schema.names) == 3
130130

131131
result = pq.ParquetFile(
132132
path, decryption_properties=file_decryption_properties)
@@ -350,14 +350,14 @@ def kms_factory(kms_connection_configuration):
350350

351351
def test_encrypted_parquet_encryption_configuration():
352352
def validate_encryption_configuration(encryption_config):
353-
assert(FOOTER_KEY_NAME == encryption_config.footer_key)
354-
assert(["a", "b"] == encryption_config.column_keys[COL_KEY_NAME])
355-
assert("AES_GCM_CTR_V1" == encryption_config.encryption_algorithm)
356-
assert(encryption_config.plaintext_footer)
357-
assert(not encryption_config.double_wrapping)
358-
assert(timedelta(minutes=10.0) == encryption_config.cache_lifetime)
359-
assert(not encryption_config.internal_key_material)
360-
assert(192 == encryption_config.data_key_length_bits)
353+
assert FOOTER_KEY_NAME == encryption_config.footer_key
354+
assert ["a", "b"] == encryption_config.column_keys[COL_KEY_NAME]
355+
assert "AES_GCM_CTR_V1" == encryption_config.encryption_algorithm
356+
assert encryption_config.plaintext_footer
357+
assert not encryption_config.double_wrapping
358+
assert timedelta(minutes=10.0) == encryption_config.cache_lifetime
359+
assert not encryption_config.internal_key_material
360+
assert 192 == encryption_config.data_key_length_bits
361361

362362
encryption_config = pe.EncryptionConfiguration(
363363
footer_key=FOOTER_KEY_NAME,
@@ -386,20 +386,20 @@ def validate_encryption_configuration(encryption_config):
386386
def test_encrypted_parquet_decryption_configuration():
387387
decryption_config = pe.DecryptionConfiguration(
388388
cache_lifetime=timedelta(minutes=10.0))
389-
assert(timedelta(minutes=10.0) == decryption_config.cache_lifetime)
389+
assert timedelta(minutes=10.0) == decryption_config.cache_lifetime
390390

391391
decryption_config_1 = pe.DecryptionConfiguration()
392392
decryption_config_1.cache_lifetime = timedelta(minutes=10.0)
393-
assert(timedelta(minutes=10.0) == decryption_config_1.cache_lifetime)
393+
assert timedelta(minutes=10.0) == decryption_config_1.cache_lifetime
394394

395395

396396
def test_encrypted_parquet_kms_configuration():
397397
def validate_kms_connection_config(kms_connection_config):
398-
assert("Instance1" == kms_connection_config.kms_instance_id)
399-
assert("URL1" == kms_connection_config.kms_instance_url)
400-
assert("MyToken" == kms_connection_config.key_access_token)
401-
assert({"key1": "key_material_1", "key2": "key_material_2"} ==
402-
kms_connection_config.custom_kms_conf)
398+
assert "Instance1" == kms_connection_config.kms_instance_id
399+
assert "URL1" == kms_connection_config.kms_instance_url
400+
assert "MyToken" == kms_connection_config.key_access_token
401+
assert ({"key1": "key_material_1", "key2": "key_material_2"} ==
402+
kms_connection_config.custom_kms_conf)
403403

404404
kms_connection_config = pe.KmsConnectionConfig(
405405
kms_instance_id="Instance1",
@@ -524,7 +524,7 @@ def kms_factory(kms_connection_configuration):
524524
# Read with decryption properties
525525
file_decryption_properties = crypto_factory.file_decryption_properties(
526526
kms_connection_config, decryption_config)
527-
assert(file_decryption_properties is not None)
527+
assert file_decryption_properties is not None
528528

529529
result = pq.ParquetFile(
530530
path, decryption_properties=file_decryption_properties)

‎python/pyarrow/tests/test_ipc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ def run(self):
848848
connection.close()
849849

850850
def get_result(self):
851-
return(self._schema, self._table if self._do_read_all
852-
else self._batches)
851+
return (self._schema, self._table if self._do_read_all
852+
else self._batches)
853853

854854

855855
class SocketStreamFixture(IpcFixture):

0 commit comments

Comments
 (0)
Please sign in to comment.