diff --git a/Cargo.lock b/Cargo.lock index ccc4e94678..e4b2a19d63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3987,7 +3987,6 @@ dependencies = [ "tempfile", "thiserror 2.0.6", "typetag", - "url", "web-time", "windows-sys 0.48.0", ] @@ -7652,7 +7651,6 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", - "serde", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 21f0ad9d2d..63add4922b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -169,7 +169,7 @@ umask = "2.1" unicode-segmentation = "1.12" unicode-width = "0.2" ureq = { version = "2.12", default-features = false, features = ["socks-proxy"] } -url = { version = "2.2", features = [ "serde" ] } +url = "2.2" uu_cp = "0.0.30" uu_mkdir = "0.0.30" uu_mktemp = "0.0.30" diff --git a/crates/nu-protocol/Cargo.toml b/crates/nu-protocol/Cargo.toml index 33bb4d98d2..e6f85a8558 100644 --- a/crates/nu-protocol/Cargo.toml +++ b/crates/nu-protocol/Cargo.toml @@ -44,7 +44,6 @@ os_pipe = { workspace = true, optional = true, features = ["io_safety"] } log = { workspace = true } web-time = { workspace = true } memchr = { workspace = true } -url = { workspace = true } [target.'cfg(unix)'.dependencies] nix = { workspace = true, default-features = false, features = ["signal"] } diff --git a/crates/nu-protocol/src/pipeline/metadata.rs b/crates/nu-protocol/src/pipeline/metadata.rs index 0b5a7feab8..b7ce2e2ee7 100644 --- a/crates/nu-protocol/src/pipeline/metadata.rs +++ b/crates/nu-protocol/src/pipeline/metadata.rs @@ -1,5 +1,4 @@ use std::path::PathBuf; -use url::Url; use serde::{Deserialize, Serialize}; @@ -35,7 +34,7 @@ pub enum DataSource { Ls, HtmlThemes, FilePath(PathBuf), - Url(Box), + Url(String), #[default] None, } diff --git a/crates/nu_plugin_polars/src/dataframe/command/core/open.rs b/crates/nu_plugin_polars/src/dataframe/command/core/open.rs index dabc48ce95..c23040f90c 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/core/open.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/core/open.rs @@ -12,9 +12,8 @@ use nu_protocol::{ shell_error::io::IoError, Category, DataSource, Example, LabeledError, PipelineData, PipelineMetadata, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, }; -use url::Url; -use std::{fs::File, io::BufReader, num::NonZeroUsize, path::PathBuf, str::FromStr, sync::Arc}; +use std::{fs::File, io::BufReader, num::NonZeroUsize, path::PathBuf, sync::Arc}; use polars::{ lazy::frame::LazyJsonLineReader, @@ -129,8 +128,8 @@ impl PluginCommand for OpenDataFrame { fn run( &self, plugin: &Self::Plugin, - engine: &EngineInterface, - call: &EvaluatedCall, + engine: &nu_plugin::EngineInterface, + call: &nu_plugin::EvaluatedCall, input: PipelineData, ) -> Result { let metadata = input.metadata(); @@ -182,9 +181,7 @@ fn command( let uri = spanned_file.item.clone(); let data_source = if resource.cloud_options.is_some() { - Url::from_str(&uri) - .map(|url| DataSource::Url(url.into())) - .unwrap_or_else(|_| DataSource::FilePath(uri.into())) + DataSource::Url(uri) } else { DataSource::FilePath(uri.into()) }; diff --git a/crates/nu_plugin_polars/src/dataframe/command/data/cut.rs b/crates/nu_plugin_polars/src/dataframe/command/data/cut.rs index fd9e18abfe..d80fdca0c5 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/data/cut.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/data/cut.rs @@ -51,7 +51,7 @@ impl PluginCommand for CutSeries { engine: &EngineInterface, call: &EvaluatedCall, input: PipelineData, - ) -> Result { + ) -> Result { let metadata = input.metadata(); self.run_inner(plugin, engine, call, input) .map(|pd| pd.set_metadata(metadata)) diff --git a/crates/nu_plugin_polars/src/dataframe/command/data/qcut.rs b/crates/nu_plugin_polars/src/dataframe/command/data/qcut.rs index 1591ccb42e..b49bc44d1e 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/data/qcut.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/data/qcut.rs @@ -52,7 +52,7 @@ impl PluginCommand for QCutSeries { engine: &EngineInterface, call: &EvaluatedCall, input: PipelineData, - ) -> Result { + ) -> Result { let metadata = input.metadata(); self.run_inner(plugin, engine, call, input) .map(|pd| pd.set_metadata(metadata)) diff --git a/crates/nu_plugin_polars/src/dataframe/command/datetime/get_day.rs b/crates/nu_plugin_polars/src/dataframe/command/datetime/get_day.rs index c6b641bd1d..2dfee0226b 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/datetime/get_day.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/datetime/get_day.rs @@ -88,6 +88,14 @@ impl PluginCommand for GetDay { self.run_inner(plugin, engine, call, input) .map(|pd| pd.set_metadata(metadata)) } + + fn extra_description(&self) -> &str { + "" + } + + fn search_terms(&self) -> Vec<&str> { + vec![] + } } impl GetDay { @@ -100,14 +108,6 @@ impl GetDay { ) -> Result { command(plugin, engine, call, input).map_err(LabeledError::from) } - - fn extra_description(&self) -> &str { - "" - } - - fn search_terms(&self) -> Vec<&str> { - vec![] - } } fn command( diff --git a/crates/nu_plugin_polars/src/dataframe/command/datetime/truncate.rs b/crates/nu_plugin_polars/src/dataframe/command/datetime/truncate.rs index 7e9281f148..389b32b9a3 100644 --- a/crates/nu_plugin_polars/src/dataframe/command/datetime/truncate.rs +++ b/crates/nu_plugin_polars/src/dataframe/command/datetime/truncate.rs @@ -154,6 +154,16 @@ impl PluginCommand for Truncate { self.run_inner(plugin, engine, call, input) .map(|pd| pd.set_metadata(metadata)) } + + fn extra_description(&self) -> &str { + r#"Each date/datetime is mapped to the start of its bucket using the corresponding local datetime. Note that weekly buckets start on Monday. Ambiguous results are localised using the DST offset of the original timestamp - for example, truncating '2022-11-06 01:30:00 CST' by '1h' results in '2022-11-06 01:00:00 CST', whereas truncating '2022-11-06 01:30:00 CDT' by '1h' results in '2022-11-06 01:00:00 CDT'. + + See Notes in documentation for full list of compatible string values for `every`: https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.dt.truncate.html"# + } + + fn search_terms(&self) -> Vec<&str> { + vec![] + } } impl Truncate { @@ -166,16 +176,6 @@ impl Truncate { ) -> Result { command(plugin, engine, call, input).map_err(LabeledError::from) } - - fn extra_description(&self) -> &str { - r#"Each date/datetime is mapped to the start of its bucket using the corresponding local datetime. Note that weekly buckets start on Monday. Ambiguous results are localised using the DST offset of the original timestamp - for example, truncating '2022-11-06 01:30:00 CST' by '1h' results in '2022-11-06 01:00:00 CST', whereas truncating '2022-11-06 01:30:00 CDT' by '1h' results in '2022-11-06 01:00:00 CDT'. - - See Notes in documentation for full list of compatible string values for `every`: https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.dt.truncate.html"# - } - - fn search_terms(&self) -> Vec<&str> { - vec![] - } } fn command(