Added num/malachite features for format crate

d

d
This commit is contained in:
Harsha Teja Kanna 2023-12-15 14:03:44 -06:00
parent 29c4728dbe
commit d71e528deb
6 changed files with 17 additions and 3 deletions

View file

@ -20,7 +20,7 @@ rustpython-parser-vendored = { path = "vendored", version = "0.3.0" }
rustpython-ast = { path = "ast", default-features = false, version = "0.3.0" } rustpython-ast = { path = "ast", default-features = false, version = "0.3.0" }
rustpython-parser-core = { path = "core", features = [], version = "0.3.0" } rustpython-parser-core = { path = "core", features = [], version = "0.3.0" }
rustpython-literal = { path = "literal", version = "0.3.0" } rustpython-literal = { path = "literal", version = "0.3.0" }
rustpython-format = { path = "format", version = "0.3.0" } rustpython-format = { path = "format", default-features = false, version = "0.3.0" }
rustpython-parser = { path = "parser", default-features = false, version = "0.3.0" } rustpython-parser = { path = "parser", default-features = false, version = "0.3.0" }
anyhow = "1.0.45" anyhow = "1.0.45"

View file

@ -16,6 +16,8 @@ fold = []
unparse = ["rustpython-literal"] unparse = ["rustpython-literal"]
visitor = [] visitor = []
all-nodes-with-ranges = [] all-nodes-with-ranges = []
malachite-bigint = ["dep:malachite-bigint"]
num-bigint = ["dep:num-bigint"]
[dependencies] [dependencies]
rustpython-parser-core = { workspace = true } rustpython-parser-core = { workspace = true }

View file

@ -8,10 +8,16 @@ repository = { workspace = true }
license = { workspace = true } license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
[features]
default = ["malachite-bigint"]
malachite-bigint = ["dep:malachite-bigint"]
num-bigint = ["dep:num-bigint"]
[dependencies] [dependencies]
rustpython-literal = { workspace = true } rustpython-literal = { workspace = true }
bitflags = { workspace = true } bitflags = { workspace = true }
itertools = { workspace = true } itertools = { workspace = true }
malachite-bigint = { workspace = true } malachite-bigint = { workspace = true, optional = true }
num-bigint = { workspace = true, optional = true }
num-traits = { workspace = true } num-traits = { workspace = true }

View file

@ -1,7 +1,10 @@
//! Implementation of Printf-Style string formatting //! Implementation of Printf-Style string formatting
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting). //! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
use bitflags::bitflags; use bitflags::bitflags;
#[cfg(feature = "malachite-bigint")]
use malachite_bigint::{BigInt, Sign}; use malachite_bigint::{BigInt, Sign};
#[cfg(feature = "num-bigint")]
use num_bigint::{BigInt, Sign};
use num_traits::Signed; use num_traits::Signed;
use rustpython_literal::{float, format::Case}; use rustpython_literal::{float, format::Case};
use std::{ use std::{

View file

@ -1,5 +1,8 @@
use itertools::{Itertools, PeekingNext}; use itertools::{Itertools, PeekingNext};
#[cfg(feature = "malachite-bigint")]
use malachite_bigint::{BigInt, Sign}; use malachite_bigint::{BigInt, Sign};
#[cfg(feature = "num-bigint")]
use num_bigint::{BigInt, Sign};
use num_traits::FromPrimitive; use num_traits::FromPrimitive;
use num_traits::{cast::ToPrimitive, Signed}; use num_traits::{cast::ToPrimitive, Signed};
use rustpython_literal::float; use rustpython_literal::float;

View file

@ -24,7 +24,7 @@ phf_codegen = "0.11.1"
tiny-keccak = { version = "2", features = ["sha3"] } tiny-keccak = { version = "2", features = ["sha3"] }
[dependencies] [dependencies]
rustpython-ast = { workspace = true } rustpython-ast = { workspace = true, default-features = false }
rustpython-parser-core = { workspace = true } rustpython-parser-core = { workspace = true }
itertools = { workspace = true } itertools = { workspace = true }