Skip to content

Commit 5034450

Browse files
committed
Enabled ruff rule EM101
1 parent 8b4212f commit 5034450

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

benchmarks/db-benchmark/join-datafusion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def ans_shape(batches):
5757
os.path.join("data", y_data_name[2] + ".csv"),
5858
]
5959
if len(src_jn_y) != 3:
60-
raise Exception("Something went wrong in preparing files used for join")
60+
error_msg = "Something went wrong in preparing files used for join"
61+
raise Exception(error_msg)
6162

6263
print(
6364
"loading datasets "

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ignore = [
8383
#"PT001",
8484
# "ANN204",
8585
# "B008",
86-
"EM101",
86+
# "EM101",
8787
"PLR0913",
8888
"PLR1714",
8989
"ANN201",

python/datafusion/dataframe.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,18 +529,17 @@ def join(
529529

530530
if on is not None:
531531
if left_on is not None or right_on is not None:
532-
raise ValueError(
533-
"`left_on` or `right_on` should not provided with `on`"
534-
)
532+
error_msg = "`left_on` or `right_on` should not provided with `on`"
533+
raise ValueError(error_msg)
535534
left_on = on
536535
right_on = on
537536
elif left_on is not None or right_on is not None:
538537
if left_on is None or right_on is None:
539-
raise ValueError("`left_on` and `right_on` should both be provided.")
538+
error_msg = "`left_on` and `right_on` should both be provided."
539+
raise ValueError(error_msg)
540540
else:
541-
raise ValueError(
542-
"either `on` or `left_on` and `right_on` should be provided."
543-
)
541+
error_msg = "either `on` or `left_on` and `right_on` should be provided."
542+
raise ValueError(error_msg)
544543
if isinstance(left_on, str):
545544
left_on = [left_on]
546545
if isinstance(right_on, str):

python/datafusion/expr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,8 @@ def cast(
454454
try:
455455
to = self._to_pyarrow_types[to]
456456
except KeyError:
457-
raise TypeError(
458-
"Expected instance of pyarrow.DataType or builtins.type"
459-
)
457+
error_msg = "Expected instance of pyarrow.DataType or builtins.type"
458+
raise TypeError(error_msg)
460459

461460
return Expr(self.expr.cast(to))
462461

0 commit comments

Comments
 (0)