Skip to content

Commit

Permalink
Merge pull request #120 from fpgmaas/chore/improve-ruff
Browse files Browse the repository at this point in the history
chore: enable `F401` and `F403`
  • Loading branch information
SemyonSinchenko authored Jul 17, 2024
2 parents 1d983b7 + df85851 commit 34b37b1
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 20 deletions.
15 changes: 14 additions & 1 deletion chispa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Add PySpark to the library path based on the value of SPARK_HOME if pyspark is not already in our path
try:
from pyspark import context
from pyspark import context # noqa: F401
except ImportError:
# We need to add PySpark, try use findspark, or failback to the "manually" find it
try:
Expand Down Expand Up @@ -68,3 +68,16 @@ def assert_df_equality(
ignore_metadata,
self.formats,
)


__all__ = (
"DataFramesNotEqualError",
"assert_df_equality",
"assert_approx_df_equality",
"ColumnsNotEqualError",
"assert_column_equality",
"assert_approx_column_equality",
"assert_basic_rows_equality",
"DefaultFormats",
"Chispa",
)
2 changes: 1 addition & 1 deletion chispa/column_comparer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from chispa.bcolors import *
from chispa.bcolors import bcolors
from prettytable import PrettyTable


Expand Down
1 change: 0 additions & 1 deletion chispa/rows_comparer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from itertools import zip_longest
from prettytable import PrettyTable
from chispa.bcolors import *
import chispa
from chispa.terminal_str_formatter import format_string
from chispa.default_formats import DefaultFormats
Expand Down
2 changes: 1 addition & 1 deletion chispa/schema_comparer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from prettytable import PrettyTable
from chispa.bcolors import *
from chispa.bcolors import blue
from itertools import zip_longest


Expand Down
2 changes: 1 addition & 1 deletion chispa/structfield_comparer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from chispa.schema_comparer import are_structfields_equal

__all__ = "are_structfields_equal"
__all__ = ("are_structfields_equal",)
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ preview = true
[tool.ruff.lint]
ignore = [
"E501", # Line too long
"F401", # imported but unused;
"F403", # `from X import *` used; unable to detect undefined names
"F405", # X may be undefined, or defined from star imports
"F841", # Local variable `e_info` is assigned to but never used
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_column_comparer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from .spark import spark
from chispa import *
from chispa import assert_column_equality, ColumnsNotEqualError, assert_approx_column_equality


def describe_assert_column_equality():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dataframe_comparer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from .spark import *
from chispa import *
from .spark import spark
from chispa import assert_df_equality, DataFramesNotEqualError, assert_approx_df_equality
from chispa.dataframe_comparer import are_dfs_equal
from chispa.schema_comparer import SchemasNotEqualError
import math
Expand Down
13 changes: 11 additions & 2 deletions tests/test_readme_examples.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import pytest

from chispa import *
from chispa import (
assert_column_equality,
ColumnsNotEqualError,
assert_df_equality,
DataFramesNotEqualError,
assert_approx_df_equality,
assert_approx_column_equality,
assert_basic_rows_equality,
)
import pyspark.sql.functions as F
from chispa.schema_comparer import SchemasNotEqualError
from pyspark.sql.types import *
from pyspark.sql.types import StringType, IntegerType, DoubleType, StructField, StructType, ArrayType


from pyspark.sql import SparkSession

Expand Down
3 changes: 1 addition & 2 deletions tests/test_row_comparer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .spark import *
from chispa.row_comparer import *
from chispa.row_comparer import are_rows_equal_enhanced, are_rows_equal, are_rows_approx_equal
from pyspark.sql import Row


Expand Down
5 changes: 2 additions & 3 deletions tests/test_rows_comparer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest

from .spark import *
from chispa import *
from chispa.rows_comparer import assert_basic_rows_equality
from .spark import spark
from chispa import assert_basic_rows_equality
from chispa import DataFramesNotEqualError


Expand Down
10 changes: 8 additions & 2 deletions tests/test_schema_comparer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import pytest

from pyspark.sql.types import *
from chispa.schema_comparer import *
from pyspark.sql.types import StringType, IntegerType, DoubleType, StructField, StructType, ArrayType
from chispa.schema_comparer import (
assert_schema_equality,
SchemasNotEqualError,
assert_schema_equality_ignore_nullable,
are_schemas_equal_ignore_nullable,
are_structfields_equal,
)


def describe_assert_schema_equality():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_structfield_comparer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from chispa.structfield_comparer import are_structfields_equal
from pyspark.sql.types import *
from pyspark.sql.types import StructField, IntegerType, StructType, DoubleType


def describe_are_structfields_equal():
Expand Down

0 comments on commit 34b37b1

Please sign in to comment.