Skip to content

Commit 7fbe148

Browse files
committed
Making ruff happy
1 parent 07c2741 commit 7fbe148

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

python/datafusion/expr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def _iter(
276276

277277
return list(_iter(exprs))
278278

279+
279280
def _to_raw_literal_expr(value: Expr | Any) -> expr_internal.Expr:
280281
"""Convert an expression or Python literal to its raw variant.
281282
@@ -294,6 +295,7 @@ def _to_raw_literal_expr(value: Expr | Any) -> expr_internal.Expr:
294295
return value.expr
295296
return Expr.literal(value).expr
296297

298+
297299
def _to_raw_expr(value: Expr | str) -> expr_internal.Expr:
298300
"""Convert a Python expression or column name to its raw variant.
299301

python/datafusion/functions.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,9 @@ def radians(arg: Expr) -> Expr:
14411441
return Expr(f.radians(arg.expr))
14421442

14431443

1444-
def regexp_like(string: Expr, regex: Expr | Any, flags: Expr | Any | None = None) -> Expr:
1444+
def regexp_like(
1445+
string: Expr, regex: Expr | Any, flags: Expr | Any | None = None
1446+
) -> Expr:
14451447
r"""Find if any regular expression (regex) matches exist.
14461448
14471449
Tests a string using a regular expression returning true if at least one match,
@@ -1476,7 +1478,9 @@ def regexp_like(string: Expr, regex: Expr | Any, flags: Expr | Any | None = None
14761478
return Expr(f.regexp_like(string.expr, _to_raw_literal_expr(regex), flags))
14771479

14781480

1479-
def regexp_match(string: Expr, regex: Expr | Any, flags: Expr | Any | None = None) -> Expr:
1481+
def regexp_match(
1482+
string: Expr, regex: Expr | Any, flags: Expr | Any | None = None
1483+
) -> Expr:
14801484
r"""Perform regular expression (regex) matching.
14811485
14821486
Returns an array with each element containing the leftmost-first match of the
@@ -1512,7 +1516,10 @@ def regexp_match(string: Expr, regex: Expr | Any, flags: Expr | Any | None = Non
15121516

15131517

15141518
def regexp_replace(
1515-
string: Expr, pattern: Expr | Any, replacement: Expr | Any, flags: Expr | Any | None = None
1519+
string: Expr,
1520+
pattern: Expr | Any,
1521+
replacement: Expr | Any,
1522+
flags: Expr | Any | None = None,
15161523
) -> Expr:
15171524
r"""Replaces substring(s) matching a PCRE-like regular expression.
15181525
@@ -1556,7 +1563,10 @@ def regexp_replace(
15561563

15571564

15581565
def regexp_count(
1559-
string: Expr, pattern: Expr | Any, start: Expr | Any | None = None, flags: Expr | Any | None = None
1566+
string: Expr,
1567+
pattern: Expr | Any,
1568+
start: Expr | Any | None = None,
1569+
flags: Expr | Any | None = None,
15601570
) -> Expr:
15611571
"""Returns the number of matches in a string.
15621572
@@ -1590,7 +1600,9 @@ def regexp_count(
15901600
# return Expr(f.regexp_count(string.expr, pattern.expr, start, flags))
15911601
flags = _to_raw_literal_expr(flags) if flags is not None else None
15921602
start = _to_raw_literal_expr(start) if start is not None else None
1593-
return Expr(f.regexp_count(string.expr, _to_raw_literal_expr(pattern), start, flags))
1603+
return Expr(
1604+
f.regexp_count(string.expr, _to_raw_literal_expr(pattern), start, flags)
1605+
)
15941606

15951607

15961608
def regexp_instr(

0 commit comments

Comments
 (0)