parameters: (self, row, tolerate_culled=False)
docstring: Takes sqlite database session row and turns it into a dictionary
docstring_summary: Takes sqlite database session row and turns it into a dictionary
docstring_tokens: Takes sqlite database session row and turns it into a dictionary
function: def row_to_model(self, row, tolerate_culled=False):
          """Takes sqlite database session row and turns it into a dictionary"""
          kernel_culled = yield maybe_future(self.kernel_culled(row['kernel_id']))
          if kernel_culled:
              # The kernel was culled or died without deleting the session.
              # We can't use delete_session here because that tries to find
              # and shut down the kernel - so we'll delete the row directly.
              #
              # If caller wishes to tolerate culled kernels, log a warning
              # and return None.  Otherwise, raise KeyError with a similar
              # message.
              self.cursor.execute("DELETE FROM session WHERE session_id=?",
                                  (row['session_id'],))
              msg = "Kernel '{kernel_id}' appears to have been culled or died unexpectedly, " \
                    "invalidating session '{session_id}'. The session has been removed.".\
                  format(kernel_id=row['kernel_id'],session_id=row['session_id'])
              if tolerate_culled:
                  self.log.warning(msg + "  Continuing...")
                  raise gen.Return(None)
              raise KeyError(msg)
  
          kernel_model = yield maybe_future(self.kernel_manager.kernel_model(row['kernel_id']))
          model = {
              'id': row['session_id'],
              'path': row['path'],
              'name': row['name'],
              'type': row['type'],
              'kernel': kernel_model
          }
          if row['type'] == 'notebook':
              # Provide the deprecated API.
              model['notebook'] = {'path': row['path'], 'name': row['name']}
          raise gen.Return(model)
function_tokens: def row_to_model ( self , row , tolerate_culled = False ) : kernel_culled = yield maybe_future ( self . kernel_culled ( row [ 'kernel_id' ] ) ) if kernel_culled : # The kernel was culled or died without deleting the session. # We can't use delete_session here because that tries to find # and shut down the kernel - so we'll delete the row directly. # # If caller wishes to tolerate culled kernels, log a warning # and return None.  Otherwise, raise KeyError with a similar # message. self . cursor . execute ( "DELETE FROM session WHERE session_id=?" , ( row [ 'session_id' ] , ) ) msg = "Kernel '{kernel_id}' appears to have been culled or died unexpectedly, " "invalidating session '{session_id}'. The session has been removed." . format ( kernel_id = row [ 'kernel_id' ] , session_id = row [ 'session_id' ] ) if tolerate_culled : self . log . warning ( msg + "  Continuing..." ) raise gen . Return ( None ) raise KeyError ( msg ) kernel_model = yield maybe_future ( self . kernel_manager . kernel_model ( row [ 'kernel_id' ] ) ) model = { 'id' : row [ 'session_id' ] , 'path' : row [ 'path' ] , 'name' : row [ 'name' ] , 'type' : row [ 'type' ] , 'kernel' : kernel_model } if row [ 'type' ] == 'notebook' : # Provide the deprecated API. model [ 'notebook' ] = { 'path' : row [ 'path' ] , 'name' : row [ 'name' ] } raise gen . Return ( model )