Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jun 24, 2024
1 parent 9693b38 commit 311a934
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions polars_xdt/functions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import annotations

import re
import sys
import warnings
from datetime import date, timedelta
from pathlib import Path
from typing import TYPE_CHECKING, Literal, Sequence

Expand All @@ -17,6 +14,8 @@
from typing_extensions import TypeAlias

if TYPE_CHECKING:
from datetime import date

from polars.type_aliases import IntoExpr

RollStrategy: TypeAlias = Literal["raise", "forward", "backward"]
Expand Down Expand Up @@ -50,7 +49,6 @@ def get_weekmask(weekend: Sequence[str]) -> list[bool]:
return weekmask



def is_workday(
expr: IntoExpr,
*,
Expand Down Expand Up @@ -104,7 +102,10 @@ def is_workday(
expr = parse_into_expr(expr)
weekend_int = [mapping[x] for x in weekend]
if holidays is not None:
return ~(expr.dt.date().is_in(holidays) | expr.dt.weekday().is_in(weekend_int))
return ~(
expr.dt.date().is_in(holidays)
| expr.dt.weekday().is_in(weekend_int)
)
return ~expr.dt.weekday().is_in(weekend_int)


Expand Down Expand Up @@ -675,4 +676,3 @@ def arg_previous_greater(expr: IntoExpr) -> pl.Expr:
is_elementwise=False,
args=[expr],
)

3 changes: 2 additions & 1 deletion polars_xdt/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def date_range(

@overload
def date_range(
start: date| IntoExprColumn,
start: date | IntoExprColumn,
end: date | IntoExprColumn,
interval: str | timedelta = "1d",
*,
Expand Down Expand Up @@ -119,6 +119,7 @@ def date_range( # noqa: PLR0913
│ 2023-01-09 │
│ 2023-01-10 │
└────────────┘
"""
if weekend == ("Sat", "Sun"):
weekend_int = [6, 7]
Expand Down
2 changes: 0 additions & 2 deletions src/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ pub fn from_local_datetime_output(
Ok(Field::new(&field.name, dtype))
}


#[polars_expr(output_type=Int32)]
fn month_delta(inputs: &[Series]) -> PolarsResult<Series> {
let start_dates = &inputs[0];
let end_dates = &inputs[1];
impl_month_delta(start_dates, end_dates)
}


#[polars_expr(output_type_func=to_local_datetime_output)]
fn to_local_datetime(inputs: &[Series]) -> PolarsResult<Series> {
let s1 = &inputs[0];
Expand Down

0 comments on commit 311a934

Please sign in to comment.