Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Nov 14, 2023
1 parent d5491a0 commit e4d1fd6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions bindings/python/src/pre_tokenizers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,30 +494,30 @@ impl PyMetaspace {
// Assuming Metaspace has a method to get the prepend_scheme as a string
let scheme: PrependScheme = getter!(self_, Metaspace, get_prepend_scheme());
match scheme {
PrependScheme::First => "First",
PrependScheme::Never => "Never",
PrependScheme::Always => "Always",
PrependScheme::First => "first",
PrependScheme::Never => "never",
PrependScheme::Always => "always",
}
.to_string()
}
const UNKNOWN_VARIANT_ERROR_MESSAGE: &str =
"is an unknown variant, should be one of ['First', 'Never', 'Always']";

#[setter]
fn set_prepend_scheme(self_: PyRef<Self>, prepend_scheme: &str) -> PyResult<()> {
// Assuming Metaspace has a method to set the prepend_scheme from a string
from_string(string: String) -> Result<PrependScheme>{

Check failure on line 504 in bindings/python/src/pre_tokenizers.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

expected one of `!` or `::`, found `(`
let scheme = match prepend_scheme {
"First" => PrependScheme::First,
"Never" => PrependScheme::Never,
"Always" => PrependScheme::Always,
"first" => PrependScheme::First,
"never" => PrependScheme::Never,
"always" => PrependScheme::Always,
_ => {
return Err(exceptions::PyValueError::new_err(format!(
"{} {}",
prepend_scheme,
Self::UNKNOWN_VARIANT_ERROR_MESSAGE,
"{} is an unknown variant, should be one of ['first', 'never', 'always']",
)));
}
};
}

#[setter]
fn set_prepend_scheme(self_: PyRef<Self>, prepend_scheme: &str) -> PyResult<()> {
// Assuming Metaspace has a method to set the prepend_scheme from a string

setter!(self_, Metaspace, @set_prepend_scheme, scheme);
Ok(())
}
Expand Down

0 comments on commit e4d1fd6

Please sign in to comment.