Skip to content

Commit 7cb5937

Browse files
committed
Enabled ruff rule B904
1 parent ebab774 commit 7cb5937

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ ignore = [
8989
# "ANN201",
9090
# "C400",
9191
"TRY003",
92-
"B904",
92+
# "B904",
9393
"UP006",
9494
"RUF012",
9595
"FBT003",

python/datafusion/dataframe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def from_str(cls: Type[Compression], value: str) -> Compression:
8989
"""
9090
try:
9191
return cls(value.lower())
92-
except ValueError:
92+
except ValueError as err:
9393
valid_values = str([item.value for item in Compression])
9494
raise ValueError(
9595
f"{value} is not a valid Compression. Valid values are: {valid_values}"
96-
)
96+
) from err
9797

9898
def get_default_level(self) -> Optional[int]:
9999
"""Get the default compression level for the compression type.

python/datafusion/expr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ def cast(
453453
if not isinstance(to, pa.DataType):
454454
try:
455455
to = self._to_pyarrow_types[to]
456-
except KeyError:
456+
except KeyError as err:
457457
error_msg = "Expected instance of pyarrow.DataType or builtins.type"
458-
raise TypeError(error_msg)
458+
raise TypeError(error_msg) from err
459459

460460
return Expr(self.expr.cast(to))
461461

0 commit comments

Comments
 (0)