diff --git a/pyo3-object_store/src/azure.rs b/pyo3-object_store/src/azure.rs index 475c87f..9390e20 100644 --- a/pyo3-object_store/src/azure.rs +++ b/pyo3-object_store/src/azure.rs @@ -122,7 +122,7 @@ impl PyAzureStore { retry_config: Option, kwargs: Option, ) -> PyObjectStoreResult { - // We manually parse the URL to find the prefix because `with_url` does not apply the + // We manually parse the URL to find the prefix because `parse_url` does not apply the // prefix. let (_, prefix) = ObjectStoreScheme::parse(url.as_ref()).map_err(object_store::Error::from)?; @@ -131,27 +131,15 @@ impl PyAzureStore { } else { None }; - let config = parse_url(config, url.as_ref())?; - let mut builder = MicrosoftAzureBuilder::from_env().with_url(url.clone()); - let combined_config = combine_config_kwargs(Some(config), kwargs)?; - builder = combined_config.clone().apply_config(builder); - if let Some(client_options) = client_options.clone() { - builder = builder.with_client_options(client_options.into()) - } - if let Some(retry_config) = retry_config.clone() { - builder = builder.with_retry(retry_config.into()) - } - Ok(Self { - store: Arc::new(MaybePrefixedStore::new(builder.build()?, prefix.clone())), - config: AzureConfig { - prefix, - config: combined_config, - client_options, - retry_config, - }, - }) - // Ok(Self(Arc::new(builder.build()?))) + Self::new( + None, + prefix, + Some(config), + client_options, + retry_config, + kwargs, + ) } fn __getnewargs_ex__(&self, py: Python) -> PyResult { diff --git a/pyo3-object_store/src/gcp.rs b/pyo3-object_store/src/gcp.rs index bdf2849..ec6a784 100644 --- a/pyo3-object_store/src/gcp.rs +++ b/pyo3-object_store/src/gcp.rs @@ -122,7 +122,7 @@ impl PyGCSStore { retry_config: Option, kwargs: Option, ) -> PyObjectStoreResult { - // We manually parse the URL to find the prefix because `with_url` does not apply the + // We manually parse the URL to find the prefix because `parse_url` does not apply the // prefix. let (_, prefix) = ObjectStoreScheme::parse(url.as_ref()).map_err(object_store::Error::from)?; @@ -132,24 +132,14 @@ impl PyGCSStore { None }; let config = parse_url(config, url.as_ref())?; - let mut builder = GoogleCloudStorageBuilder::from_env().with_url(url.clone()); - let combined_config = combine_config_kwargs(Some(config), kwargs)?; - builder = combined_config.clone().apply_config(builder); - if let Some(client_options) = client_options.clone() { - builder = builder.with_client_options(client_options.into()) - } - if let Some(retry_config) = retry_config.clone() { - builder = builder.with_retry(retry_config.into()) - } - Ok(Self { - store: Arc::new(MaybePrefixedStore::new(builder.build()?, prefix.clone())), - config: GCSConfig { - prefix, - config: combined_config, - client_options, - retry_config, - }, - }) + Self::new( + None, + prefix, + Some(config), + client_options, + retry_config, + kwargs, + ) } fn __getnewargs_ex__(&self, py: Python) -> PyResult {