- 
                Notifications
    
You must be signed in to change notification settings  - Fork 312
 
          Add allow_partial
          #1512
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  
    Add allow_partial
  
  #1512
                      Changes from all commits
2bf9d9b
              554ec40
              6cd985d
              b5b2332
              45ef7d5
              92e694f
              470754d
              bd127eb
              417ad13
              0d453a0
              ee72ba9
              132f757
              f28aaba
              47f1c15
              e220710
              a0936cd
              6478dba
              5a521a8
              327083c
              833ddfb
              b1226d5
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -110,7 +110,8 @@ where | |
| let output = PyDict::new_bound(self.py); | ||
| let mut errors: Vec<ValLineError> = Vec::new(); | ||
| 
     | 
||
| for item_result in iterator { | ||
| for (_, is_last_partial, item_result) in self.state.enumerate_last_partial(iterator) { | ||
| self.state.allow_partial = false; | ||
| let (key, value) = item_result?; | ||
| let output_key = match self.key_validator.validate(self.py, key.borrow_input(), self.state) { | ||
| Ok(value) => Some(value), | ||
| 
        
          
        
         | 
    @@ -124,19 +125,20 @@ where | |
| Err(ValError::Omit) => continue, | ||
| Err(err) => return Err(err), | ||
| }; | ||
| self.state.allow_partial = is_last_partial; | ||
| let output_value = match self.value_validator.validate(self.py, value.borrow_input(), self.state) { | ||
| Ok(value) => Some(value), | ||
| Ok(value) => value, | ||
| Err(ValError::LineErrors(line_errors)) => { | ||
| for err in line_errors { | ||
| errors.push(err.with_outer_location(key.clone())); | ||
| if !is_last_partial { | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I'm feeling very baited to refactor these error combiners now 😂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #1517 as a spike to start down that road.  | 
||
| errors.extend(line_errors.into_iter().map(|err| err.with_outer_location(key.clone()))); | ||
| } | ||
| None | ||
| continue; | ||
| } | ||
| Err(ValError::Omit) => continue, | ||
| Err(err) => return Err(err), | ||
| }; | ||
| if let (Some(key), Some(value)) = (output_key, output_value) { | ||
| output.set_item(key, value)?; | ||
| if let Some(key) = output_key { | ||
| output.set_item(key, output_value)?; | ||
| } | ||
| } | ||
| 
     | 
||
| 
          
            
          
           | 
    ||
Uh oh!
There was an error while loading. Please reload this page.