1#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
3pub(crate) const FMT_MAX_COLS: &str = "POLARS_FMT_MAX_COLS";
4pub(crate) const FMT_MAX_ROWS: &str = "POLARS_FMT_MAX_ROWS";
5pub(crate) const FMT_STR_LEN: &str = "POLARS_FMT_STR_LEN";
6#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
7pub(crate) const FMT_TABLE_CELL_ALIGNMENT: &str = "POLARS_FMT_TABLE_CELL_ALIGNMENT";
8#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
9pub(crate) const FMT_TABLE_CELL_NUMERIC_ALIGNMENT: &str = "POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT";
10#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
11pub(crate) const FMT_TABLE_DATAFRAME_SHAPE_BELOW: &str = "POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW";
12#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
13pub(crate) const FMT_TABLE_FORMATTING: &str = "POLARS_FMT_TABLE_FORMATTING";
14#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
15pub(crate) const FMT_TABLE_HIDE_COLUMN_DATA_TYPES: &str = "POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES";
16#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
17pub(crate) const FMT_TABLE_HIDE_COLUMN_NAMES: &str = "POLARS_FMT_TABLE_HIDE_COLUMN_NAMES";
18#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
19pub(crate) const FMT_TABLE_HIDE_COLUMN_SEPARATOR: &str = "POLARS_FMT_TABLE_HIDE_COLUMN_SEPARATOR";
20#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
21pub(crate) const FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION: &str =
22 "POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION";
23#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
24pub(crate) const FMT_TABLE_INLINE_COLUMN_DATA_TYPE: &str =
25 "POLARS_FMT_TABLE_INLINE_COLUMN_DATA_TYPE";
26#[cfg(any(feature = "fmt", feature = "fmt_no_tty"))]
27pub(crate) const FMT_TABLE_ROUNDED_CORNERS: &str = "POLARS_FMT_TABLE_ROUNDED_CORNERS";
28pub(crate) const FMT_TABLE_CELL_LIST_LEN: &str = "POLARS_FMT_TABLE_CELL_LIST_LEN";
29
30pub fn verbose() -> bool {
31 std::env::var("POLARS_VERBOSE").as_deref().unwrap_or("") == "1"
32}
33
34pub fn get_engine_affinity() -> String {
35 std::env::var("POLARS_ENGINE_AFFINITY").unwrap_or_else(|_| "auto".to_string())
36}
37
38pub fn verbose_print_sensitive<F: Fn() -> String>(create_log_message: F) {
40 fn do_log(create_log_message: &dyn Fn() -> String) {
41 if std::env::var("POLARS_VERBOSE_SENSITIVE").as_deref() == Ok("1") {
42 let msg = create_log_message().replace('\n', " ");
44 eprintln!("[SENSITIVE]: {msg}")
45 }
46 }
47
48 do_log(&create_log_message)
49}
50
51pub fn force_async() -> bool {
52 std::env::var("POLARS_FORCE_ASYNC")
53 .map(|value| value == "1")
54 .unwrap_or_default()
55}