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

Function validate_capture

crates/vm/src/stdlib/_ast/validate.rs:152–157  ·  view source on GitHub ↗
(vm: &VirtualMachine, name: &ast::Identifier)

Source from the content-addressed store, hash-verified

150}
151
152fn validate_capture(vm: &VirtualMachine, name: &ast::Identifier) -> PyResult<()> {
153 if name.as_str() == "_" {
154 return Err(vm.new_value_error("can't capture name '_' in patterns"));
155 }
156 validate_name(vm, name.id())
157}
158
159fn validate_pattern(vm: &VirtualMachine, pattern: &ast::Pattern, star_ok: bool) -> PyResult<()> {
160 match pattern {

Callers 1

validate_patternFunction · 0.85

Calls 4

validate_nameFunction · 0.85
ErrClass · 0.50
as_strMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected