You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2022/08/03 14:23:07 UTC

[arrow] branch master updated: ARROW-17282: [Python] flake8 update fails linter CI (#13778)

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b987d92d1 ARROW-17282: [Python] flake8 update fails linter CI (#13778)
3b987d92d1 is described below

commit 3b987d92d14ce7b5f5ccd2afb7366273e20348d4
Author: Jacob Wujciak-Jens <ja...@wujciak.de>
AuthorDate: Wed Aug 3 16:22:57 2022 +0200

    ARROW-17282: [Python] flake8 update fails linter CI (#13778)
    
    Authored-by: Jacob Wujciak-Jens <ja...@wujciak.de>
    Signed-off-by: Antoine Pitrou <an...@python.org>
---
 .pre-commit-config.yaml                         |  2 +-
 dev/archery/archery/utils/command.py            |  2 +-
 python/pyarrow/parquet/__init__.py              | 10 +++----
 python/pyarrow/tests/parquet/encryption.py      |  3 +-
 python/pyarrow/tests/parquet/test_encryption.py | 40 ++++++++++++-------------
 python/pyarrow/tests/test_ipc.py                |  4 +--
 6 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7fd35b1aa8..7311b5a9a3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -37,7 +37,7 @@ repos:
         entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -
         exclude: ^dev/.*$
   - repo: https://github.com/pycqa/flake8
-    rev: 4.0.1
+    rev: 5.0.3
     hooks:
       - id: flake8
         name: Python Format
diff --git a/dev/archery/archery/utils/command.py b/dev/archery/archery/utils/command.py
index f655e2ef2e..c3161164d3 100644
--- a/dev/archery/archery/utils/command.py
+++ b/dev/archery/archery/utils/command.py
@@ -24,7 +24,7 @@ from .logger import logger, ctx
 
 
 def default_bin(name, default):
-    assert(default)
+    assert default
     env_name = "ARCHERY_{0}_BIN".format(default.upper())
     return name if name else os.environ.get(env_name, default)
 
diff --git a/python/pyarrow/parquet/__init__.py b/python/pyarrow/parquet/__init__.py
index 868a83f0eb..5feb922060 100644
--- a/python/pyarrow/parquet/__init__.py
+++ b/python/pyarrow/parquet/__init__.py
@@ -109,13 +109,13 @@ def _check_filters(filters, check_null_strings=True):
     return filters
 
 
-_DNF_filter_doc = """Predicates are expressed in disjunctive normal form (DNF), like
-    ``[[('x', '=', 0), ...], ...]``. DNF allows arbitrary boolean logical
+_DNF_filter_doc = """Predicates are expressed in disjunctive normal form (DNF),
+    like ``[[('x', '=', 0), ...], ...]``. DNF allows arbitrary boolean logical
     combinations of single column predicates. The innermost tuples each
     describe a single column predicate. The list of inner predicates is
-    interpreted as a conjunction (AND), forming a more selective and
-    multiple column predicate. Finally, the most outer list combines these
-    filters as a disjunction (OR).
+    interpreted as a conjunction (AND), forming a more selective and multiple
+    column predicate. Finally, the most outer list combines these filters as a
+    disjunction (OR).
 
     Predicates may also be passed as List[Tuple]. This form is interpreted
     as a single conjunction. To express OR in predicates, one must
diff --git a/python/pyarrow/tests/parquet/encryption.py b/python/pyarrow/tests/parquet/encryption.py
index b0465ec6ec..d07f8ae273 100644
--- a/python/pyarrow/tests/parquet/encryption.py
+++ b/python/pyarrow/tests/parquet/encryption.py
@@ -20,7 +20,8 @@ import pyarrow.parquet.encryption as pe
 
 
 class InMemoryKmsClient(pe.KmsClient):
-    """This is a mock class implementation of KmsClient, built for testing only.
+    """This is a mock class implementation of KmsClient, built for testing
+    only.
     """
 
     def __init__(self, config):
diff --git a/python/pyarrow/tests/parquet/test_encryption.py b/python/pyarrow/tests/parquet/test_encryption.py
index 924339797f..db9bc52e46 100644
--- a/python/pyarrow/tests/parquet/test_encryption.py
+++ b/python/pyarrow/tests/parquet/test_encryption.py
@@ -109,7 +109,7 @@ def write_encrypted_parquet(path, table, encryption_config,
                             kms_connection_config, crypto_factory):
     file_encryption_properties = crypto_factory.file_encryption_properties(
         kms_connection_config, encryption_config)
-    assert(file_encryption_properties is not None)
+    assert file_encryption_properties is not None
     with pq.ParquetWriter(
             path, table.schema,
             encryption_properties=file_encryption_properties) as writer:
@@ -120,13 +120,13 @@ def read_encrypted_parquet(path, decryption_config,
                            kms_connection_config, crypto_factory):
     file_decryption_properties = crypto_factory.file_decryption_properties(
         kms_connection_config, decryption_config)
-    assert(file_decryption_properties is not None)
+    assert file_decryption_properties is not None
     meta = pq.read_metadata(
         path, decryption_properties=file_decryption_properties)
-    assert(meta.num_columns == 3)
+    assert meta.num_columns == 3
     schema = pq.read_schema(
         path, decryption_properties=file_decryption_properties)
-    assert(len(schema.names) == 3)
+    assert len(schema.names) == 3
 
     result = pq.ParquetFile(
         path, decryption_properties=file_decryption_properties)
@@ -350,14 +350,14 @@ def test_encrypted_parquet_write_kms_factory_type_error(
 
 def test_encrypted_parquet_encryption_configuration():
     def validate_encryption_configuration(encryption_config):
-        assert(FOOTER_KEY_NAME == encryption_config.footer_key)
-        assert(["a", "b"] == encryption_config.column_keys[COL_KEY_NAME])
-        assert("AES_GCM_CTR_V1" == encryption_config.encryption_algorithm)
-        assert(encryption_config.plaintext_footer)
-        assert(not encryption_config.double_wrapping)
-        assert(timedelta(minutes=10.0) == encryption_config.cache_lifetime)
-        assert(not encryption_config.internal_key_material)
-        assert(192 == encryption_config.data_key_length_bits)
+        assert FOOTER_KEY_NAME == encryption_config.footer_key
+        assert ["a", "b"] == encryption_config.column_keys[COL_KEY_NAME]
+        assert "AES_GCM_CTR_V1" == encryption_config.encryption_algorithm
+        assert encryption_config.plaintext_footer
+        assert not encryption_config.double_wrapping
+        assert timedelta(minutes=10.0) == encryption_config.cache_lifetime
+        assert not encryption_config.internal_key_material
+        assert 192 == encryption_config.data_key_length_bits
 
     encryption_config = pe.EncryptionConfiguration(
         footer_key=FOOTER_KEY_NAME,
@@ -386,20 +386,20 @@ def test_encrypted_parquet_encryption_configuration():
 def test_encrypted_parquet_decryption_configuration():
     decryption_config = pe.DecryptionConfiguration(
         cache_lifetime=timedelta(minutes=10.0))
-    assert(timedelta(minutes=10.0) == decryption_config.cache_lifetime)
+    assert timedelta(minutes=10.0) == decryption_config.cache_lifetime
 
     decryption_config_1 = pe.DecryptionConfiguration()
     decryption_config_1.cache_lifetime = timedelta(minutes=10.0)
-    assert(timedelta(minutes=10.0) == decryption_config_1.cache_lifetime)
+    assert timedelta(minutes=10.0) == decryption_config_1.cache_lifetime
 
 
 def test_encrypted_parquet_kms_configuration():
     def validate_kms_connection_config(kms_connection_config):
-        assert("Instance1" == kms_connection_config.kms_instance_id)
-        assert("URL1" == kms_connection_config.kms_instance_url)
-        assert("MyToken" == kms_connection_config.key_access_token)
-        assert({"key1": "key_material_1", "key2": "key_material_2"} ==
-               kms_connection_config.custom_kms_conf)
+        assert "Instance1" == kms_connection_config.kms_instance_id
+        assert "URL1" == kms_connection_config.kms_instance_url
+        assert "MyToken" == kms_connection_config.key_access_token
+        assert ({"key1": "key_material_1", "key2": "key_material_2"} ==
+                kms_connection_config.custom_kms_conf)
 
     kms_connection_config = pe.KmsConnectionConfig(
         kms_instance_id="Instance1",
@@ -524,7 +524,7 @@ def test_encrypted_parquet_loop(tempdir, data_table, basic_encryption_config):
         # Read with decryption properties
         file_decryption_properties = crypto_factory.file_decryption_properties(
             kms_connection_config, decryption_config)
-        assert(file_decryption_properties is not None)
+        assert file_decryption_properties is not None
 
         result = pq.ParquetFile(
             path, decryption_properties=file_decryption_properties)
diff --git a/python/pyarrow/tests/test_ipc.py b/python/pyarrow/tests/test_ipc.py
index 1b4aaaed6d..b7192867dc 100644
--- a/python/pyarrow/tests/test_ipc.py
+++ b/python/pyarrow/tests/test_ipc.py
@@ -848,8 +848,8 @@ class StreamReaderServer(threading.Thread):
             connection.close()
 
     def get_result(self):
-        return(self._schema, self._table if self._do_read_all
-               else self._batches)
+        return (self._schema, self._table if self._do_read_all
+                else self._batches)
 
 
 class SocketStreamFixture(IpcFixture):