MCPcopy Index your code
hub / github.com/RustPython/RustPython / _bool

Method _bool

crates/derive-impl/src/util.rs:223–241  ·  view source on GitHub ↗
(&self, key: &str)

Source from the content-addressed store, hash-verified

221 }
222
223 pub fn _bool(&self, key: &str) -> Result<bool> {
224 let value = if let Some((_, meta)) = self.meta_map.get(key) {
225 match meta {
226 Meta::NameValue(syn::MetaNameValue {
227 value:
228 syn::Expr::Lit(syn::ExprLit {
229 lit: syn::Lit::Bool(lit),
230 ..
231 }),
232 ..
233 }) => lit.value,
234 Meta::Path(_) => true,
235 _ => bail_span!(meta, "#[{}({})] is expected", self.meta_name(), key),
236 }
237 } else {
238 false
239 };
240 Ok(value)
241 }
242
243 pub fn _optional_list(
244 &self,

Callers 9

impl_pyclassFunction · 0.80
rawMethod · 0.80
getset_nameMethod · 0.80
member_nameMethod · 0.80
subMethod · 0.80
unhashableMethod · 0.80
has_implMethod · 0.80
no_attrMethod · 0.80
gen_module_itemMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected