class Dependabot::Uv::FileFetcher

def fetch_child_requirement_files(file:, previously_fetched_files:)

def fetch_child_requirement_files(file:, previously_fetched_files:)
  paths = file.content.scan(CHILD_REQUIREMENT_REGEX).flatten
  current_dir = File.dirname(file.name)
  paths.flat_map do |path|
    path = File.join(current_dir, path) unless current_dir == "."
    path = cleanpath(path)
    next if previously_fetched_files.map(&:name).include?(path)
    next if file.name == path
    fetched_file = fetch_file_from_host(path)
    grandchild_requirement_files = fetch_child_requirement_files(
      file: fetched_file,
      previously_fetched_files: previously_fetched_files + [file]
    )
    [fetched_file, *grandchild_requirement_files]
  end.compact
end