class_docstr: Download data from https://rajpurkar.github.io/SQuAD-explorer/
  Will return tuples of (doc, question, answer, answer_start, has_answer)
class_docstr_tok: ["Download","data","from","https",":","\/\/rajpurkar.github.io\/SQuAD-explorer\/","Will","return","tuples","of","(","doc",",","question",",","answer",",","answer_start",",","has_answer",")"]
code: def process_squad_json(self, fname):
      if not fname:
          return
      if not PathManager.exists(fname):
          print(f"{fname} does not exist. Not unflattening.")
          return
      with PathManager.open(fname) as infile:
          dump = json.load(infile)
  
      id = 0
      for article in dump["data"]:
          for paragraph in article["paragraphs"]:
              doc = paragraph["context"]
              for question in paragraph["qas"]:
                  has_answer = not question.get("is_impossible", False)
                  answers = (
                      question["answers"]
                      if has_answer
                      else question["plausible_answers"]
                  )
                  question = question["question"]
                  answer_texts = [answer["text"] for answer in answers]
                  answer_starts = [
                      int(answer["answer_start"]) for answer in answers
                  ]
  
                  if not has_answer:
                      answer_texts = []
                      answer_starts = []
  
                  for piece_dict in _split_document(
                      id,
                      doc,
                      question,
                      answer_texts,
                      answer_starts,
                      has_answer,
                      self.ignore_impossible,
                      self.max_character_length,
                      self.min_overlap,
                  ):
                      yield piece_dict
                  id += 1
  
imports: import json
  import math
  from random import choice
  from typing import List, Optional
  from pytext.data.sources.data_source import DataSource, generator_property, JSONString, SafeFileWrapper
  from pytext.data.sources.tsv import TSV
  from pytext.utils.file_io import PathManager
  from pytext.utils.path import get_absolute_path
label_desc: Use image node_id 4 for calling the SquadDataSource obj's underlying member method code with example usage: obj.process_squad_json(fname) without return types