Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Jan 23, 2025
1 parent 72a0586 commit f7732c3
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 43 deletions.
1 change: 1 addition & 0 deletions crates/polars-core/src/chunked_array/temporal/duration.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use chrono::Duration as ChronoDuration;

use crate::fmt::{fmt_duration_string, iso_duration_string};
use crate::prelude::DataType::Duration;
use crate::prelude::*;
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-lazy/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ fn load_df() -> DataFrame {

use std::io::Cursor;

#[cfg(feature = "temporal")]
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use optimization_checks::*;
use polars_core::chunked_array::builder::get_list_builder;
use polars_core::df;
#[cfg(feature = "temporal")]
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use polars_core::prelude::*;
#[cfg(feature = "parquet")]
pub(crate) use polars_core::SINGLE_LOCK;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/chunked_array/array/to_struct.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rayon::prelude::*;
use polars_core::POOL;
use polars_utils::format_pl_smallstr;
use polars_utils::pl_str::PlSmallStr;
use rayon::prelude::*;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions crates/polars-ops/src/chunked_array/list/hash.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::hash::Hash;

use rayon::prelude::*;
use polars_core::series::BitRepr;
use polars_core::utils::NoNull;
use polars_utils::hashing::_boost_hash_combine;
use polars_core::{with_match_physical_float_polars_type, POOL};
use polars_utils::hashing::_boost_hash_combine;
use polars_utils::total_ord::{ToTotalOrd, TotalHash};
use rayon::prelude::*;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions crates/polars-ops/src/chunked_array/list/namespace.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fmt::Write;

use arrow::array::ValueSize;
use polars_compute::gather::sublist::list::{index_is_oob, sublist_get};
use polars_core::chunked_array::builder::get_list_builder;
#[cfg(feature = "list_gather")]
use num_traits::ToPrimitive;
#[cfg(feature = "list_gather")]
use num_traits::{NumCast, Signed, Zero};
use polars_compute::gather::sublist::list::{index_is_oob, sublist_get};
use polars_core::chunked_array::builder::get_list_builder;
#[cfg(feature = "diff")]
use polars_core::series::ops::NullBehavior;
use polars_core::utils::try_get_supertype;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/chunked_array/list/to_struct.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rayon::prelude::*;
use polars_core::POOL;
use polars_utils::format_pl_smallstr;
use polars_utils::pl_str::PlSmallStr;
use rayon::prelude::*;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/chunked_array/strings/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::iter::zip;
#[cfg(feature = "extract_groups")]
use arrow::array::{Array, StructArray};
use arrow::array::{MutablePlString, Utf8ViewArray};
use regex::Regex;
use polars_core::prelude::arity::{try_binary_mut_with_options, try_unary_mut_with_options};
use regex::Regex;

use super::*;

Expand Down
3 changes: 1 addition & 2 deletions crates/polars-ops/src/chunked_array/strings/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ use base64::engine::general_purpose;
use base64::Engine as _;
#[cfg(feature = "string_to_integer")]
use num_traits::Num;
use regex::Regex;
use polars_core::prelude::arity::*;
use polars_utils::cache::FastFixedCache;
use regex::escape;
use regex::{escape, Regex};

use super::*;
#[cfg(feature = "binary_encoding")]
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-ops/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pub mod join;
pub mod pivot;

pub use join::*;
#[cfg(feature = "to_dummies")]
use rayon::prelude::*;
use polars_core::prelude::*;
#[cfg(feature = "to_dummies")]
use polars_core::utils::accumulate_dataframes_horizontal;
#[cfg(feature = "to_dummies")]
use polars_core::POOL;
#[cfg(feature = "to_dummies")]
use rayon::prelude::*;

pub trait IntoDf {
fn to_df(&self) -> &DataFrame;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/frame/pivot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ mod unpivot;

use std::borrow::Cow;

use rayon::prelude::*;
use polars_core::frame::group_by::expr::PhysicalAggExpr;
use polars_core::prelude::*;
use polars_core::utils::_split_offsets;
use polars_core::{downcast_as_macro_arg_physical, POOL};
use polars_utils::format_pl_smallstr;
use rayon::prelude::*;
pub use unpivot::UnpivotDF;

const HASHMAP_INIT_SIZE: usize = 512;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::ops::{Add, Div, Mul, Sub};

use arrow::array::PrimitiveArray;
use arrow::bitmap::MutableBitmap;
use polars_core::downcast_as_macro_arg_physical;
use num_traits::{NumCast, Zero};
use polars_core::downcast_as_macro_arg_physical;
use polars_core::prelude::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/series/ops/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use polars_core::prelude::*;
#[cfg(feature = "moment")]
use {
crate::series::ops::moment::MomentSeries,
num_traits::{Float, FromPrimitive, pow::Pow},
num_traits::{pow::Pow, Float, FromPrimitive},
polars_core::utils::with_unstable_series,
std::ops::SubAssign,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::ops::Add;
use arrow::array::{Array, PrimitiveArray};
use polars_compute::sum::{wrapping_sum_arr, WrappingSum};
use arrow::compute::aggregate::Sum;
use arrow::types::simd::Simd;
use arrow::datatypes::PrimitiveType;
use arrow::types::simd::Simd;
use num_traits::NumCast;
use polars_core::prelude::*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::any::Any;

use arrow::array::PrimitiveArray;
use polars_compute::min_max::MinMaxKernel;
use num_traits::NumCast;
use polars_compute::min_max::MinMaxKernel;
use polars_core::prelude::*;
use polars_utils::min_max::MinMax;

Expand Down
3 changes: 1 addition & 2 deletions crates/polars-plan/src/dsl/function_expr/pow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use num_traits::pow::Pow;
use num_traits::{One, Zero};
use num_traits::{Float, ToPrimitive};
use num_traits::{Float, One, ToPrimitive, Zero};
use polars_core::prelude::arity::{broadcast_binary_elementwise, unary_elementwise_values};
use polars_core::with_match_physical_integer_type;

Expand Down
7 changes: 3 additions & 4 deletions crates/polars-python/src/conversion/any_value.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
use std::borrow::{Borrow, Cow};

use chrono::{
DateTime, Datelike, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime, TimeDelta, Timelike,
};
use chrono_tz::Tz;
#[cfg(feature = "object")]
use polars::chunked_array::object::PolarsObjectSafe;
#[cfg(feature = "object")]
use polars::datatypes::OwnedObject;
use polars::datatypes::{DataType, Field, PlHashMap, TimeUnit};
use chrono::{DateTime, FixedOffset};
use polars::prelude::{AnyValue, PlSmallStr, Series};
use chrono::{
Datelike, NaiveDate, NaiveDateTime, NaiveTime, TimeDelta, Timelike,
};
use polars_core::utils::any_values_to_supertype_and_n_dtypes;
use polars_core::utils::arrow::temporal_conversions::date32_to_date;
use pyo3::exceptions::{PyOverflowError, PyTypeError, PyValueError};
Expand Down
4 changes: 1 addition & 3 deletions crates/polars-python/src/conversion/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
use std::str::FromStr;

use chrono::{DateTime, FixedOffset, NaiveDateTime, NaiveTime, TimeDelta, TimeZone as _};
use chrono_tz::Tz;
use polars::datatypes::TimeUnit;
use polars_core::datatypes::TimeZone;
use chrono::{
DateTime, FixedOffset, NaiveDateTime, NaiveTime, TimeDelta, TimeZone as _,
};
use pyo3::{Bound, IntoPyObject, PyAny, PyResult, Python};

use crate::error::PyPolarsErr;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-python/src/dataframe/export.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use arrow::datatypes::IntegerType;
use arrow::record_batch::RecordBatch;
use polars::prelude::*;
use arrow::datatypes::IntegerType;
use polars_compute::cast::CastOptionsImpl;
use pyo3::prelude::*;
use pyo3::types::{PyCapsule, PyList, PyTuple};
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-python/src/dataframe/general.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::mem::ManuallyDrop;

use either::Either;
use arrow::bitmap::MutableBitmap;
use either::Either;
use polars::prelude::*;
#[cfg(feature = "pivot")]
use polars_lazy::frame::pivot::{pivot, pivot_stable};
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-python/src/functions/io.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::io::BufReader;

use arrow::array::Utf8ViewArray;
#[cfg(any(feature = "ipc", feature = "parquet"))]
use polars::prelude::ArrowSchema;
use polars_core::datatypes::create_enum_dtype;
use arrow::array::Utf8ViewArray;
use pyo3::prelude::*;
use pyo3::types::PyDict;

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-python/src/interop/arrow/to_rust.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use rayon::prelude::*;
use polars_core::prelude::*;
use polars_core::utils::accumulate_dataframes_vertical_unchecked;
use polars_core::utils::arrow::ffi;
use polars_core::POOL;
use pyo3::ffi::Py_uintptr_t;
use pyo3::prelude::*;
use pyo3::types::PyList;
use rayon::prelude::*;

use crate::error::PyPolarsErr;

Expand Down
4 changes: 2 additions & 2 deletions crates/polars-python/src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ pub mod series;

use std::collections::BTreeMap;

use polars::chunked_array::builder::get_list_builder;
use arrow::bitmap::BitmapBuilder;
use polars::chunked_array::builder::get_list_builder;
use polars::prelude::*;
use rayon::prelude::*;
use polars_core::utils::CustomIterTools;
use polars_core::POOL;
use polars_utils::pl_str::PlSmallStr;
use pyo3::prelude::*;
use pyo3::pybacked::PyBackedStr;
use pyo3::types::PyDict;
use rayon::prelude::*;

use crate::error::PyPolarsErr;
use crate::prelude::ObjectValue;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-python/src/series/construction.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::borrow::Cow;

use numpy::{Element, PyArray1, PyArrayMethods};
use arrow::array::Array;
use arrow::bitmap::MutableBitmap;
use arrow::types::NativeType;
use numpy::{Element, PyArray1, PyArrayMethods};
use polars_core::prelude::*;
use polars_core::utils::CustomIterTools;
use pyo3::exceptions::{PyTypeError, PyValueError};
Expand Down
4 changes: 1 addition & 3 deletions crates/polars-python/src/series/import.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use arrow::array::Array;
use arrow::ffi;
use arrow::ffi::{
ArrowArray, ArrowArrayStream, ArrowArrayStreamReader, ArrowSchema,
};
use arrow::ffi::{ArrowArray, ArrowArrayStream, ArrowArrayStreamReader, ArrowSchema};
use polars::prelude::*;
use pyo3::exceptions::{PyTypeError, PyValueError};
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-sql/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//!
//! It also provides utility functions for working with SQL datatypes.
use polars_core::datatypes::{DataType, TimeUnit};
use regex::{Regex, RegexBuilder};
use polars_error::{polars_bail, PolarsResult};
use polars_plan::dsl::{lit, Expr};
use regex::{Regex, RegexBuilder};
use sqlparser::ast::{
ArrayElemTypeDef, DataType as SQLDataType, ExactNumberInfo, Ident, ObjectName, TimezoneInfo,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-time/src/group_by/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use arrow::legacy::time_zone::Tz;
use arrow::legacy::utils::CustomIterTools;
use rayon::prelude::*;
use polars_core::prelude::*;
use polars_core::series::IsSorted;
use polars_core::utils::flatten::flatten_par;
Expand All @@ -9,6 +8,7 @@ use polars_ops::series::SeriesMethods;
use polars_utils::idx_vec::IdxVec;
use polars_utils::pl_str::PlSmallStr;
use polars_utils::slice::SortedSlice;
use rayon::prelude::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

Expand Down
5 changes: 2 additions & 3 deletions crates/polars-time/src/windows/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use std::ops::{Mul, Neg};
use arrow::legacy::kernels::{Ambiguous, NonExistent};
use arrow::legacy::time_zone::Tz;
use arrow::temporal_conversions::{
timestamp_ms_to_datetime, timestamp_ns_to_datetime, timestamp_us_to_datetime, MILLISECONDS,
NANOSECONDS,
timestamp_ms_to_datetime, timestamp_ns_to_datetime, timestamp_us_to_datetime, MICROSECONDS,
MILLISECONDS, NANOSECONDS,
};
use chrono::{Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike};
use polars_core::datatypes::DataType;
use arrow::temporal_conversions::MICROSECONDS;
use polars_core::prelude::{
datetime_to_timestamp_ms, datetime_to_timestamp_ns, datetime_to_timestamp_us, polars_bail,
PolarsResult,
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-time/src/windows/group_by.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use arrow::legacy::time_zone::Tz;
use arrow::trusted_len::TrustedLen;
use rayon::prelude::*;
use polars_core::prelude::*;
use polars_core::utils::_split_offsets;
use polars_core::utils::flatten::flatten_par;
use polars_core::POOL;
use rayon::prelude::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use strum_macros::IntoStaticStr;
Expand Down

0 comments on commit f7732c3

Please sign in to comment.