original_docstring:  Filter the notebook at the notebook_URL so that it only contains
              the questions and answers to the reading.
          
docstring: Filter the notebook at the notebook_URL so that it only contains
  the questions and answers to the reading.
docstring_tokens: Filter the notebook at the notebook_URL so that it only contains the questions and answers to the reading .
code: def extract(self):
          """ Filter the notebook at the notebook_URL so that it only contains
              the questions and answers to the reading.
          """
          nbs = {}
          for url in self.notebook_URLs:
              print url
              fid = urllib.urlopen(url)
              nbs[url] = json.load(fid)
              fid.close()
          filtered_cells = []
          for i, prompt in enumerate(question_prompts):
              for j, url in enumerate(nbs):
                  response_cells = prompt.get_closest_match(nbs[url]['cells'], NotebookExtractor.MATCH_THRESH, j != 0)
                  if not response_cells:
                      print "Missed", prompt.question_heading, " for ", url
                  elif not response_cells[-1]['source']:
                      pass
                      #print "Blank", prompt.question_heading, " for ", url
                  else:
                      #print "response cells length", len(response_cells)
                      #print response_cells[1]['source'], len(response_cells[1]['source'])
                      filtered_cells.extend(response_cells)
  
          leading, nb_name_full = os.path.split(self.notebook_URLs[0])
          nb_name_stem, extension = os.path.splitext(nb_name_full)
  
          print "Writing out values"
          fid = open(nb_name_stem + "_responses.ipynb", 'wt')
  
          answer_book = deepcopy(nbs[self.notebook_URLs[0]])
          answer_book['cells'] = filtered_cells
          json.dump(answer_book, fid)
          fid.close()
code_tokens: def extract ( self ) : nbs = { } for url in self . notebook_URLs : print url fid = urllib . urlopen ( url ) nbs [ url ] = json . load ( fid ) fid . close ( ) filtered_cells = [ ] for i , prompt in enumerate ( question_prompts ) : for j , url in enumerate ( nbs ) : response_cells = prompt . get_closest_match ( nbs [ url ] [ 'cells' ] , NotebookExtractor . MATCH_THRESH , j != 0 ) if not response_cells : print "Missed" , prompt . question_heading , " for " , url elif not response_cells [ - 1 ] [ 'source' ] : pass else : filtered_cells . extend ( response_cells ) leading , nb_name_full = os . path . split ( self . notebook_URLs [ 0 ] ) nb_name_stem , extension = os . path . splitext ( nb_name_full ) print "Writing out values" fid = open ( nb_name_stem + "_responses.ipynb" , 'wt' ) answer_book = deepcopy ( nbs [ self . notebook_URLs [ 0 ] ] ) answer_book [ 'cells' ] = filtered_cells json . dump ( answer_book , fid ) fid . close ( )
short_docstring: Filter the notebook at the notebook_URL so that it only contains
  the questions and answers to the reading.
short_docstring_tokens: Filter the notebook at the notebook_URL so that it only contains the questions and answers to the reading .
comment: """ Filter the notebook at the notebook_URL so that it only contains
              the questions and answers to the reading.
          """$SEP$#print "Blank", prompt.question_heading, " for ", url$SEP$#print "response cells length", len(response_cells)$SEP$#print response_cells[1]['source'], len(response_cells[1]['source'])