class Dependabot::Uv::FileUpdater::LockFileUpdater

def updated_lockfile_content

def updated_lockfile_content
  @updated_lockfile_content ||=
    begin
      original_content = lockfile.content
      # Extract the original requires-python value to preserve it
      original_requires_python = original_content
                                 .match(/requires-python\s*=\s*["']([^"']+)["']/)&.captures&.first
      # Store the original Python version requirement for later use
      @original_python_version = original_requires_python
      new_lockfile = updated_lockfile_content_for(prepared_pyproject)
      # Normalize line endings to ensure proper comparison
      new_lockfile = normalize_line_endings(new_lockfile, original_content)
      result = new_lockfile
      # Restore the original requires-python if it exists
      if original_requires_python
        result = result.gsub(/requires-python\s*=\s*["'][^"']+["']/,
                             "requires-python = \"#{original_requires_python}\"")
      end
      result
    end
end