with open('crates/fluids/src/coolprop.rs', 'r') as f: text = f.read() # 1. Bring FluidBackend into scope at the top of the file text = text.replace('use crate::backend::DampedBackend;', 'use crate::backend::{DampedBackend, FluidBackend};') if 'use crate::backend::FluidBackend;' not in text and 'use crate::backend::{DampedBackend, FluidBackend};' not in text: text = text.replace('use crate::errors::{FluidError, FluidResult};', 'use crate::errors::{FluidError, FluidResult};\nuse crate::backend::FluidBackend;') # 2. Fix _fluid back to fluid in phase_mix text = text.replace('fn phase_mix(&self, _fluid: FluidId, state: FluidState)', 'fn phase_mix(&self, fluid: FluidId, state: FluidState)') with open('crates/fluids/src/coolprop.rs', 'w') as f: f.write(text)