original_docstring: This method determines if the 'mode' of a schema entry can
          transition from REQUIRED -> NULLABLE. A REQUIRED mode can only have
          come from an existing schema (though the --existing_schema_path
          flag), because REQUIRED is created only in the flatten_schema()
          method. Therefore, a NULLABLE->REQUIRED transition cannot occur.
  
          We have the following sub cases for the REQUIRED -> NULLABLE
          transition:
  
          1) If the target is filled=True, then we will retain the REQUIRED
              mode.
          2) If the target is filled=False, then we control the outcome by
              overloading the --infer_mode flag:
              a) If --infer_mode is given, then we allow the
                  REQUIRED -> NULLABLE transition.
              b) If --infer_mode is not given, then we log an error and ignore
                  this field from the schema.
          
docstring: This method determines if the 'mode' of a schema entry can
  transition from REQUIRED -> NULLABLE. A REQUIRED mode can only have
  come from an existing schema (though the --existing_schema_path
  flag), because REQUIRED is created only in the flatten_schema()
  method. Therefore, a NULLABLE->REQUIRED transition cannot occur.
  
  We have the following sub cases for the REQUIRED -> NULLABLE
  transition.
  
  1) If the target is filled=True, then we will retain the REQUIRED
  mode.
docstring_tokens: This method determines if the ' mode ' of a schema entry can transition from REQUIRED - > NULLABLE . A REQUIRED mode can only have come from an existing schema ( though the -- existing_schema_path flag ) because REQUIRED is created only in the flatten_schema () method . Therefore a NULLABLE - > REQUIRED transition cannot occur . We have the following sub cases for the REQUIRED - > NULLABLE transition . 1 ) If the target is filled = True then we will retain the REQUIRED mode .
code: def merge_mode(self, old_schema_entry, new_schema_entry, base_path):
          """This method determines if the 'mode' of a schema entry can
          transition from REQUIRED -> NULLABLE. A REQUIRED mode can only have
          come from an existing schema (though the --existing_schema_path
          flag), because REQUIRED is created only in the flatten_schema()
          method. Therefore, a NULLABLE->REQUIRED transition cannot occur.
  
          We have the following sub cases for the REQUIRED -> NULLABLE
          transition:
  
          1) If the target is filled=True, then we will retain the REQUIRED
              mode.
          2) If the target is filled=False, then we control the outcome by
              overloading the --infer_mode flag:
              a) If --infer_mode is given, then we allow the
                  REQUIRED -> NULLABLE transition.
              b) If --infer_mode is not given, then we log an error and ignore
                  this field from the schema.
          """
          old_info = old_schema_entry['info']
          new_info = new_schema_entry['info']
          old_mode = old_info['mode']
          old_name = old_info['name']
          old_type = old_info['type']
          old_status = old_schema_entry['status']
          new_mode = new_info['mode']
          new_name = new_info['name']
          new_type = new_info['type']
          new_status = new_schema_entry['status']
  
          full_old_name = json_full_path(base_path, old_name)
          full_new_name = json_full_path(base_path, new_name)
  
          # If the old field is a REQUIRED primitive (which could only have come
          # from an existing schema), the new field can be either a
          # NULLABLE(filled) or a NULLABLE(unfilled).
          if old_mode == 'REQUIRED' and new_mode == 'NULLABLE':
              # If the new field is filled, then retain the REQUIRED.
              if new_schema_entry['filled']:
                  return old_mode
              else:
                  # The new field is not filled (i.e. an empty or null field).
                  # If --infer_mode is active, then we allow the REQUIRED to
                  # revert back to NULLABLE.
                  if self.infer_mode:
                      return new_mode
                  else:
                      self.log_error(
                          f'Ignoring non-RECORD field with mismatched mode.'
                          ' cannot convert to NULLABLE because infer_schema not'
                          ' set:'
                          f' old=({old_status},{full_old_name},{old_mode},'
                          f'{old_type});'
                          f' new=({new_status},{full_new_name},{new_mode},'
                          f'{new_type})'
                      )
                      return None
          elif old_mode != new_mode:
              self.log_error(
                  f'Ignoring non-RECORD field with mismatched mode: '
                  f'old=({old_status},{full_old_name},{old_mode},'
                  f'{old_type});'
                  f' new=({new_status},{full_new_name},{new_mode},'
                  f'{new_type})'
              )
              return None
          return old_mode
code_tokens: def merge_mode ( self , old_schema_entry , new_schema_entry , base_path ) : old_info = old_schema_entry [ 'info' ] new_info = new_schema_entry [ 'info' ] old_mode = old_info [ 'mode' ] old_name = old_info [ 'name' ] old_type = old_info [ 'type' ] old_status = old_schema_entry [ 'status' ] new_mode = new_info [ 'mode' ] new_name = new_info [ 'name' ] new_type = new_info [ 'type' ] new_status = new_schema_entry [ 'status' ] full_old_name = json_full_path ( base_path , old_name ) full_new_name = json_full_path ( base_path , new_name ) if old_mode == 'REQUIRED' and new_mode == 'NULLABLE' : if new_schema_entry [ 'filled' ] : return old_mode else : if self . infer_mode : return new_mode else : self . log_error ( f'Ignoring non-RECORD field with mismatched mode.' ' cannot convert to NULLABLE because infer_schema not' ' set:' f' old=({old_status},{full_old_name},{old_mode},' f'{old_type});' f' new=({new_status},{full_new_name},{new_mode},' f'{new_type})' ) return None elif old_mode != new_mode : self . log_error ( f'Ignoring non-RECORD field with mismatched mode: ' f'old=({old_status},{full_old_name},{old_mode},' f'{old_type});' f' new=({new_status},{full_new_name},{new_mode},' f'{new_type})' ) return None return old_mode
short_docstring: This method determines if the 'mode' of a schema entry can
  transition from REQUIRED -> NULLABLE.
short_docstring_tokens: This method determines if the ' mode ' of a schema entry can transition from REQUIRED - > NULLABLE .
comment: """This method determines if the 'mode' of a schema entry can
          transition from REQUIRED -> NULLABLE. A REQUIRED mode can only have
          come from an existing schema (though the --existing_schema_path
          flag), because REQUIRED is created only in the flatten_schema()
          method. Therefore, a NULLABLE->REQUIRED transition cannot occur.
  
          We have the following sub cases for the REQUIRED -> NULLABLE
          transition:
  
          1) If the target is filled=True, then we will retain the REQUIRED
              mode.
          2) If the target is filled=False, then we control the outcome by
              overloading the --infer_mode flag:
              a) If --infer_mode is given, then we allow the
                  REQUIRED -> NULLABLE transition.
              b) If --infer_mode is not given, then we log an error and ignore
                  this field from the schema.
          """$SEP$# If the old field is a REQUIRED primitive (which could only have come$SEP$# from an existing schema), the new field can be either a$SEP$# NULLABLE(filled) or a NULLABLE(unfilled).$SEP$# If the new field is filled, then retain the REQUIRED.$SEP$# The new field is not filled (i.e. an empty or null field).$SEP$# If --infer_mode is active, then we allow the REQUIRED to$SEP$# revert back to NULLABLE.