Skip to content

Commit

Permalink
build(rust): update base64 requirement from 0.13 to 0.21 (#6249)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stijn de Gooijer <stijn@degooijer.io>
  • Loading branch information
dependabot[bot] and stinodego authored Jan 16, 2023
1 parent 461f61f commit f5c1443
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion polars/polars-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ docs-selection = [
ahash.workspace = true
anyhow.workspace = true
arrow.workspace = true
base64 = { version = "0.13", optional = true }
base64 = { version = "0.21", optional = true }
bitflags.workspace = true
chrono = { version = "0.4", optional = true }
chrono-tz = { version = "0.8", optional = true }
Expand Down
11 changes: 7 additions & 4 deletions polars/polars-core/src/chunked_array/binary/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use {base64, hex};
use base64::engine::general_purpose;
use base64::Engine as _;
use hex;

use crate::prelude::*;

Expand All @@ -19,14 +21,15 @@ impl BinaryChunked {

pub fn base64_decode(&self) -> PolarsResult<BinaryChunked> {
self.try_apply(|s| {
let bytes =
base64::decode(s).map_err(|e| PolarsError::ComputeError(e.to_string().into()))?;
let bytes = general_purpose::STANDARD
.decode(s)
.map_err(|e| PolarsError::ComputeError(e.to_string().into()))?;
Ok(bytes.into())
})
}

pub fn base64_encode(&self) -> Series {
self.apply(|s| base64::encode(s).into_bytes().into())
self.apply(|s| general_purpose::STANDARD.encode(s).into_bytes().into())
.cast_unchecked(&DataType::Utf8)
.unwrap()
}
Expand Down
6 changes: 4 additions & 2 deletions polars/polars-core/src/chunked_array/strings/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use {base64, hex};
use base64::engine::general_purpose;
use base64::Engine as _;
use hex;

use crate::prelude::*;

Expand Down Expand Up @@ -34,6 +36,6 @@ impl Utf8Chunked {

#[must_use]
pub fn base64_encode(&self) -> Utf8Chunked {
self.apply(|s| base64::encode(s).into())
self.apply(|s| general_purpose::STANDARD.encode(s).into())
}
}
10 changes: 8 additions & 2 deletions py-polars/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5c1443

Please sign in to comment.