parameters: (self, file_to_process)
docstring: Update the hash in blockname_python.cc python bindings
docstring_summary: Update the hash in blockname_python.cc python bindings
docstring_tokens: Update the hash in blockname_python . cc python bindings
function: def fix_file_hash(self, file_to_process):
          """Update the hash in blockname_python.cc python bindings"""
  
          output_dir = self.get_output_dir(file_to_process)
          base_name = os.path.splitext(os.path.basename(file_to_process))[0]
  
          hasher = hashlib.md5()
          with open(file_to_process, 'rb') as file_in:
              buf = file_in.read()
              hasher.update(buf)
          newhash = hasher.hexdigest()
  
          binding_pathname_cc = os.path.join(
              output_dir, '{}_python.cc'.format(base_name))
  
          with open(binding_pathname_cc, 'r') as f:
              file_contents = f.read()
              new_file_contents = re.sub(r'BINDTOOL_HEADER_FILE_HASH\([a-zA-Z0-9]+\)',
                                         f"BINDTOOL_HEADER_FILE_HASH({newhash})", file_contents)
              with open(binding_pathname_cc, 'w') as updated_f:
                  updated_f.write(new_file_contents)
  
              print(f"Update hash in {binding_pathname_cc} to {newhash}")
function_tokens: def fix_file_hash ( self , file_to_process ) : output_dir = self . get_output_dir ( file_to_process ) base_name = os . path . splitext ( os . path . basename ( file_to_process ) ) [ 0 ] hasher = hashlib . md5 ( ) with open ( file_to_process , 'rb' ) as file_in : buf = file_in . read ( ) hasher . update ( buf ) newhash = hasher . hexdigest ( ) binding_pathname_cc = os . path . join ( output_dir , '{}_python.cc' . format ( base_name ) ) with open ( binding_pathname_cc , 'r' ) as f : file_contents = f . read ( ) new_file_contents = re . sub ( r'BINDTOOL_HEADER_FILE_HASH\([a-zA-Z0-9]+\)' , f"BINDTOOL_HEADER_FILE_HASH({newhash})" , file_contents ) with open ( binding_pathname_cc , 'w' ) as updated_f : updated_f . write ( new_file_contents ) print ( f"Update hash in {binding_pathname_cc} to {newhash}" )