diff --git a/crates/polars-core/src/chunked_array/temporal/duration.rs b/crates/polars-core/src/chunked_array/temporal/duration.rs index 8187b67e34bb..a0a9c07205f8 100644 --- a/crates/polars-core/src/chunked_array/temporal/duration.rs +++ b/crates/polars-core/src/chunked_array/temporal/duration.rs @@ -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::*; diff --git a/crates/polars-lazy/src/tests/mod.rs b/crates/polars-lazy/src/tests/mod.rs index 4be16121ce65..65fd043377da 100644 --- a/crates/polars-lazy/src/tests/mod.rs +++ b/crates/polars-lazy/src/tests/mod.rs @@ -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; diff --git a/crates/polars-ops/src/chunked_array/array/to_struct.rs b/crates/polars-ops/src/chunked_array/array/to_struct.rs index 5732bf861a19..d316e82888c0 100644 --- a/crates/polars-ops/src/chunked_array/array/to_struct.rs +++ b/crates/polars-ops/src/chunked_array/array/to_struct.rs @@ -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::*; diff --git a/crates/polars-ops/src/chunked_array/list/hash.rs b/crates/polars-ops/src/chunked_array/list/hash.rs index 41bbbbe9543a..7e2099d62288 100644 --- a/crates/polars-ops/src/chunked_array/list/hash.rs +++ b/crates/polars-ops/src/chunked_array/list/hash.rs @@ -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::*; diff --git a/crates/polars-ops/src/chunked_array/list/namespace.rs b/crates/polars-ops/src/chunked_array/list/namespace.rs index 18f77c9c3970..5209cee70f52 100644 --- a/crates/polars-ops/src/chunked_array/list/namespace.rs +++ b/crates/polars-ops/src/chunked_array/list/namespace.rs @@ -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; diff --git a/crates/polars-ops/src/chunked_array/list/to_struct.rs b/crates/polars-ops/src/chunked_array/list/to_struct.rs index b6aa3076d446..4b0ccde25a45 100644 --- a/crates/polars-ops/src/chunked_array/list/to_struct.rs +++ b/crates/polars-ops/src/chunked_array/list/to_struct.rs @@ -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::*; diff --git a/crates/polars-ops/src/chunked_array/strings/extract.rs b/crates/polars-ops/src/chunked_array/strings/extract.rs index f184b7d79053..421b91486b08 100644 --- a/crates/polars-ops/src/chunked_array/strings/extract.rs +++ b/crates/polars-ops/src/chunked_array/strings/extract.rs @@ -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::*; diff --git a/crates/polars-ops/src/chunked_array/strings/namespace.rs b/crates/polars-ops/src/chunked_array/strings/namespace.rs index b133f3ac9ef6..bbcf2a297e84 100644 --- a/crates/polars-ops/src/chunked_array/strings/namespace.rs +++ b/crates/polars-ops/src/chunked_array/strings/namespace.rs @@ -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")] diff --git a/crates/polars-ops/src/frame/mod.rs b/crates/polars-ops/src/frame/mod.rs index 3183645a72ce..61712317dfe5 100644 --- a/crates/polars-ops/src/frame/mod.rs +++ b/crates/polars-ops/src/frame/mod.rs @@ -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; diff --git a/crates/polars-ops/src/frame/pivot/mod.rs b/crates/polars-ops/src/frame/pivot/mod.rs index 63bd123649e4..34d553a65db0 100644 --- a/crates/polars-ops/src/frame/pivot/mod.rs +++ b/crates/polars-ops/src/frame/pivot/mod.rs @@ -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; diff --git a/crates/polars-ops/src/series/ops/interpolation/interpolate.rs b/crates/polars-ops/src/series/ops/interpolation/interpolate.rs index 9b79605061bc..96b6e3205ff9 100644 --- a/crates/polars-ops/src/series/ops/interpolation/interpolate.rs +++ b/crates/polars-ops/src/series/ops/interpolation/interpolate.rs @@ -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}; diff --git a/crates/polars-ops/src/series/ops/rolling.rs b/crates/polars-ops/src/series/ops/rolling.rs index 118dd9175c6e..cc77f457d48d 100644 --- a/crates/polars-ops/src/series/ops/rolling.rs +++ b/crates/polars-ops/src/series/ops/rolling.rs @@ -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, }; diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs index 8ef8d5d68dc7..c35314efcaee 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs @@ -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::*; diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs index 89e37bd8df8f..ef97d3ea0017 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs @@ -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; diff --git a/crates/polars-plan/src/dsl/function_expr/pow.rs b/crates/polars-plan/src/dsl/function_expr/pow.rs index 5f66ca5915ee..e30f4538d8dd 100644 --- a/crates/polars-plan/src/dsl/function_expr/pow.rs +++ b/crates/polars-plan/src/dsl/function_expr/pow.rs @@ -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; diff --git a/crates/polars-python/src/conversion/any_value.rs b/crates/polars-python/src/conversion/any_value.rs index 7767c33b82f6..54cd8544f669 100644 --- a/crates/polars-python/src/conversion/any_value.rs +++ b/crates/polars-python/src/conversion/any_value.rs @@ -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}; diff --git a/crates/polars-python/src/conversion/datetime.rs b/crates/polars-python/src/conversion/datetime.rs index 837de4c629c6..1d6b36d87e98 100644 --- a/crates/polars-python/src/conversion/datetime.rs +++ b/crates/polars-python/src/conversion/datetime.rs @@ -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; diff --git a/crates/polars-python/src/dataframe/export.rs b/crates/polars-python/src/dataframe/export.rs index 3850cf8d4763..cddce22ccda8 100644 --- a/crates/polars-python/src/dataframe/export.rs +++ b/crates/polars-python/src/dataframe/export.rs @@ -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}; diff --git a/crates/polars-python/src/dataframe/general.rs b/crates/polars-python/src/dataframe/general.rs index d4178b00d710..bffd1a9ab855 100644 --- a/crates/polars-python/src/dataframe/general.rs +++ b/crates/polars-python/src/dataframe/general.rs @@ -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}; diff --git a/crates/polars-python/src/functions/io.rs b/crates/polars-python/src/functions/io.rs index 4043c2cb3ca7..8aa4e7ce3403 100644 --- a/crates/polars-python/src/functions/io.rs +++ b/crates/polars-python/src/functions/io.rs @@ -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; diff --git a/crates/polars-python/src/interop/arrow/to_rust.rs b/crates/polars-python/src/interop/arrow/to_rust.rs index 250d592ed4bb..10407cb728ac 100644 --- a/crates/polars-python/src/interop/arrow/to_rust.rs +++ b/crates/polars-python/src/interop/arrow/to_rust.rs @@ -1,4 +1,3 @@ -use rayon::prelude::*; use polars_core::prelude::*; use polars_core::utils::accumulate_dataframes_vertical_unchecked; use polars_core::utils::arrow::ffi; @@ -6,6 +5,7 @@ use polars_core::POOL; use pyo3::ffi::Py_uintptr_t; use pyo3::prelude::*; use pyo3::types::PyList; +use rayon::prelude::*; use crate::error::PyPolarsErr; diff --git a/crates/polars-python/src/map/mod.rs b/crates/polars-python/src/map/mod.rs index d4b8ebc38bfa..e635b3287b91 100644 --- a/crates/polars-python/src/map/mod.rs +++ b/crates/polars-python/src/map/mod.rs @@ -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; diff --git a/crates/polars-python/src/series/construction.rs b/crates/polars-python/src/series/construction.rs index e74bd2064aed..4f8301407d4f 100644 --- a/crates/polars-python/src/series/construction.rs +++ b/crates/polars-python/src/series/construction.rs @@ -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}; diff --git a/crates/polars-python/src/series/import.rs b/crates/polars-python/src/series/import.rs index 9545016269ba..ffe88fed1eac 100644 --- a/crates/polars-python/src/series/import.rs +++ b/crates/polars-python/src/series/import.rs @@ -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::*; diff --git a/crates/polars-sql/src/types.rs b/crates/polars-sql/src/types.rs index 9caf55bbfd2a..d8df0402ab1c 100644 --- a/crates/polars-sql/src/types.rs +++ b/crates/polars-sql/src/types.rs @@ -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, }; diff --git a/crates/polars-time/src/group_by/dynamic.rs b/crates/polars-time/src/group_by/dynamic.rs index c1694e175637..61631b5ffae0 100644 --- a/crates/polars-time/src/group_by/dynamic.rs +++ b/crates/polars-time/src/group_by/dynamic.rs @@ -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; @@ -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}; diff --git a/crates/polars-time/src/windows/duration.rs b/crates/polars-time/src/windows/duration.rs index 33ec2badcee2..9d162062e295 100644 --- a/crates/polars-time/src/windows/duration.rs +++ b/crates/polars-time/src/windows/duration.rs @@ -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, diff --git a/crates/polars-time/src/windows/group_by.rs b/crates/polars-time/src/windows/group_by.rs index 70f150913e4a..9de22c73fca2 100644 --- a/crates/polars-time/src/windows/group_by.rs +++ b/crates/polars-time/src/windows/group_by.rs @@ -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;