Skip to content

Commit

Permalink
Fix linter v2
Browse files Browse the repository at this point in the history
 On branch feature/fix-tests
 Changes to be committed:
	modified:   pyproject.toml
	modified:   quinn/extensions/column_ext.py
	modified:   quinn/schema_helpers.py
	modified:   quinn/split_columns.py
  • Loading branch information
SemyonSinchenko committed Nov 16, 2023
1 parent 173493e commit 98e854c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ select = ["ALL"]
line-length = 150
ignore = [
"D100",
"D203", # Ignore blank line before summary of class
"D213", # Ignore multiline summary second line
"T201", # Allow print() in code.
"D401", # Docstrings should be in imperative modes
"D404", # Boring thing about how to write docsrings
"FBT001", # Boolean positional arg is OK
"FBT002", # Boolean default arg value is OK
"D205", # It is broken
"TCH003", # I have no idea what is it about
"D203", # Ignore blank line before summary of class
"D213", # Ignore multiline summary second line
"T201", # Allow print() in code.
"D401", # Docstrings should be in imperative modes
"D404", # Boring thing about how to write docsrings
"FBT001", # Boolean positional arg is OK
"FBT002", # Boolean default arg value is OK
"D205", # It is broken
"TCH003", # I have no idea what is it about
"PLC1901", # Strange thing
]
extend-exclude = ["tests", "docs"]

Expand Down
2 changes: 1 addition & 1 deletion quinn/extensions/column_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def isNullOrBlank(self: Column) -> Column:
blank characters, or ``False`` otherwise.
:rtype: Column
"""
return (self.isNull()) | (trim(self) == "") # noqa: PLC1901
return (self.isNull()) | (trim(self) == "")


def isNotIn(self: Column, _list: list[Any]) -> Column:
Expand Down
9 changes: 4 additions & 5 deletions quinn/schema_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def print_schema_as_code(dtype: T.DataType) -> str:
elif isinstance(dtype, T.DecimalType):
res.append(f"DecimalType({dtype.precision}, {dtype.scale})")

else:
elif str(dtype).endswith("()"):
# PySpark 3.3+
if str(dtype).endswith("()"): # noqa: PLR5501
res.append(str(dtype))
else:
res.append(f"{dtype}()")
res.append(str(dtype))
else:
res.append(f"{dtype}()")

return "".join(res)

Expand Down
4 changes: 2 additions & 2 deletions quinn/split_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _num_delimiter(col_value1: str) -> int:

# If the length of split_value is same as new_col_names, check if any of the split values is None or empty string
elif any( # noqa: RET506
x is None or x.strip() == "" for x in split_value[: len(new_col_names)] # noqa: PLC1901
x is None or x.strip() == "" for x in split_value[: len(new_col_names)]
):
msg = "Null or empty values are not accepted for columns in strict mode"
raise ValueError(
Expand All @@ -93,7 +93,7 @@ def _num_delimiter(col_value1: str) -> int:
if mode == "strict":
# Create an array of select expressions to create new columns from the split values
select_exprs = [
when(split_col_expr.getItem(i) != "", split_col_expr.getItem(i)).alias( # noqa: PLC1901
when(split_col_expr.getItem(i) != "", split_col_expr.getItem(i)).alias(
new_col_names[i],
)
for i in range(len(new_col_names))
Expand Down

0 comments on commit 98e854c

Please sign in to comment.