From 5623b087a8ce64a8de273d25b66c8093ebc1f9d6 Mon Sep 17 00:00:00 2001 From: Brian Wylie Date: Tue, 16 Jan 2024 12:51:59 -0700 Subject: [PATCH] flake8 fixes --- tox.ini | 6 +++--- zat/dataframe_to_matrix.py | 12 ++++++------ zat/log_to_sparkdf.py | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tox.ini b/tox.ini index f5e7637..51b99f0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py39, py310 flake8 +envlist = py39, py310, flake8 [testenv] setenv = @@ -20,14 +20,14 @@ commands = flake8 zat/ setup.py [testenv:codecov] -passenv = CI TRAVIS TRAVIS_* +passenv = CI,TRAVIS,TRAVIS_* deps = codecov commands = codecov [testenv:coveralls] -passenv = CI TRAVIS TRAVIS_* +passenv = CI,TRAVIS,TRAVIS_* deps = coveralls usedevelop = true diff --git a/zat/dataframe_to_matrix.py b/zat/dataframe_to_matrix.py index bb3eff7..844c489 100644 --- a/zat/dataframe_to_matrix.py +++ b/zat/dataframe_to_matrix.py @@ -246,22 +246,22 @@ def test(): print('FIT-TRANSFORM') norm_matrix = to_matrix_norm.fit_transform(test_df) print(norm_matrix) - assert(norm_matrix[:, 0].min() == 0) - assert(norm_matrix[:, 0].max() == 1) + assert (norm_matrix[:, 0].min() == 0) + assert (norm_matrix[:, 0].max() == 1) # Make sure normalize 'does the right thing' when doing transform print('TRANSFORM') norm_matrix2 = to_matrix_norm.transform(test_df2) - assert(norm_matrix2[:, 0].min() == 0) - assert(norm_matrix2[:, 0].max() == 2) # Normalization is based on FIT range + assert (norm_matrix2[:, 0].min() == 0) + assert (norm_matrix2[:, 0].max() == 2) # Normalization is based on FIT range # Test div by zero in normalize test_df3 = test_df2.copy() test_df3['D'] = [1, 1, 1, 1] print('FIT-TRANSFORM') norm_matrix3 = to_matrix_norm.fit_transform(test_df3) - assert(norm_matrix3[:, 0].min() == 1) - assert(norm_matrix3[:, 0].max() == 1) + assert (norm_matrix3[:, 0].min() == 1) + assert (norm_matrix3[:, 0].max() == 1) # Test serialization temp = NamedTemporaryFile(delete=False) diff --git a/zat/log_to_sparkdf.py b/zat/log_to_sparkdf.py index 0004705..c496729 100644 --- a/zat/log_to_sparkdf.py +++ b/zat/log_to_sparkdf.py @@ -1,7 +1,5 @@ """LogToSparkDF: Converts a Zeek log to a Spark DataFrame""" -import sys - # Third Party try: from pyspark.sql.types import StructType, StringType, IntegerType, FloatType, LongType, DoubleType