Unwind (resume) generator.
542804
def _unwindGenerator(self, generator, _prev=None):
        """"""
        while True:
            if _prev:
                ret, _prev = _prev, None
            else:
                try:
                    ret = next(generator)
                except StopIteration:
                    break

            if isinstance(ret, Request):
                if ret.callback:
                    warnings.warn("Got a request with callback set, bypassing "
                                  "the generator wrapper. Generator may not "
                                  "be able to resume. %s" % ret)
                elif ret.errback:
                    # By Scrapy defaults, a request without callback defaults to
                    # self.parse spider method.
                    warnings.warn("Got a request with errback set, bypassing "
                                  "the generator wrapper. Generator may not "
                                  "be able to resume. %s" % ret)
                else:
                    yield self._wrapRequest(ret, generator)
                    return

            # A request with callbacks, item or None object.
            yield ret
448700
def resume(self) -> None:
        """"""
        with self.__state_lock:
            if self.__state == DataChannelBuffer.State.paused:
                self.__state = DataChannelBuffer.State.started
329027
public function resumeRecv()
    {
        if ($this->_isPaused === true) {
            Worker::$globalEvent->add($this->_socket, EventInterface::EV_READ, array($this, 'baseRead'));
            $this->_isPaused = false;
            $this->baseRead($this->_socket, false);
        }
    }
1015343
def reset(cls):
        
        cls.debug = False
        cls.disabled = False
        cls.overwrite = False
        cls.playback_only = False
        cls.recv_timeout = 5
        cls.recv_endmarkers = []
        cls.recv_size = None
1313009
function unload() {
    u.each(opts.sources, function(source) {
      if (source.src && source.src.unref) { source.src.unref(); }
      if (source.cache && source.cache.unref) { source.cache.unref(); }
    });
    u.each(opts.outputs, function(output) {
      if (output.output && output.output.cancel) { output.output.cancel(); }
    });
    if (generator.reload && generator.reload.cancel) { generator.reload.cancel(); }
    if (generator.clientSave && generator.clientSave.cancel) { generator.clientSave.cancel(); }
  }
103599
function resumeable(last,source,s){
  source.last = last;
  source.on('data',function(data){
    source.last = data;
    s.write(data);
  })

  var onPause = function(){
    source.pause();
  };

  var onDrain = function(){
    source.resume();
  };

  var onEnd = function(){
    source.end();
  };

  var cleanup = function(){
    s.removeListener('pause',onPause);
    s.removeListener('drain',onDrain);
    s.removeListener('end',onEnd);
  };

  s.on('pause',onPause);
  s.on('drain',onDrain);
  s.on('end',onEnd);

  source.on('error',function(){
    source._errored = true;
    cleanup();
  });
  source.on('end',function(){
    cleanup();
    if(!source._errored) {
      s.end();
    }
  })
  return s;
}
798640
def _resume(self):
        """"""
        try:
            self._cursor.close()
        except PyMongoError:
            pass
        self._cursor = self._create_cursor()
467
def resume(self):
        
        for child in chain(self.consumers.values(), self.workers):
            child.resume()
57585
def reset(self, params, repetition):
    
    self.startTime = time.time()
    print(params)
    seed = params["seed"] + repetition
    torch.manual_seed(seed)
    np.random.seed(seed)
    random.seed(seed)

    # Get our directories correct
    self.dataDir = params["datadir"]
    if params.get("create_plots", False):
      self.resultsDir = os.path.join(params["path"], params["name"], "plots")

      if not os.path.exists(self.resultsDir):
        os.makedirs(self.resultsDir)

    self.use_cuda = not params["no_cuda"] and torch.cuda.is_available()
    self.device = torch.device("cuda" if self.use_cuda else "cpu")

    transform = transforms.Compose([transforms.ToTensor(),
                                    transforms.Normalize((0.1307,), (0.3081,))])

    train_dataset = datasets.MNIST(self.dataDir, train=True, download=True,
                                   transform=transform)

    # Create training and validation sampler from MNIST dataset by training on
    # random X% of the training set and validating on the remaining (1-X)%,
    # where X can be tuned via the "validation" parameter
    validation = params.get("validation", 50000.0 / 60000.0)
    if validation < 1.0:
      self.train_sampler, self.validation_sampler = createValidationDataSampler(
        train_dataset, validation)

      self.train_loader = torch.utils.data.DataLoader(train_dataset,
                                                      batch_size=params["batch_size"],
                                                      sampler=self.train_sampler)

      self.validation_loader = torch.utils.data.DataLoader(train_dataset,
                                                           batch_size=params["batch_size"],
                                                           sampler=self.validation_sampler)
    else:
      # No validation. Normal training dataset
      self.validation_loader = None
      self.validation_sampler = None
      self.train_sampler = None
      self.train_loader = torch.utils.data.DataLoader(train_dataset,
                                                      batch_size=params["batch_size"],
                                                      shuffle=True)


    self.test_loader = torch.utils.data.DataLoader(
      datasets.MNIST(self.dataDir, train=False, transform=transform),
      batch_size=params["test_batch_size"], shuffle=True)

    # Parse 'n' and 'k' parameters
    n = params["n"]
    k = params["k"]
    if isinstance(n, basestring):
      n = map(int, n.split("_"))
    if isinstance(k, basestring):
      k = map(int, k.split("_"))

    if params["use_cnn"]:
      c1_out_channels = params["c1_out_channels"]
      c1_k = params["c1_k"]
      if isinstance(c1_out_channels, basestring):
        c1_out_channels = map(int, c1_out_channels.split("_"))
      if isinstance(c1_k, basestring):
        c1_k = map(int, c1_k.split("_"))

      # Parse 'c1_input_shape; parameter
      if "c1_input_shape" in params:
        c1_input_shape = map(int, params["c1_input_shape"].split("_"))
      else:
        c1_input_shape = (1, 28, 28)

      sp_model = SparseNet(
        inputSize=c1_input_shape,
        outChannels=c1_out_channels,
        c_k=c1_k,
        kernelSize=5,
        stride=1,
        dropout=params["dropout"],
        n=n,
        k=k,
        outputSize=10,
        boostStrength=params["boost_strength"],
        weightSparsity=params["weight_sparsity"],
        weightSparsityCNN=params["weight_sparsity_cnn"],
        boostStrengthFactor=params["boost_strength_factor"],
        kInferenceFactor=params["k_inference_factor"],
        useBatchNorm=params["use_batch_norm"],
        normalizeWeights=params.get("normalize_weights", False)
      )
    else:
      sp_model = SparseNet(
        n=n,
        k=k,
        outputSize=10,
        boostStrength=params["boost_strength"],
        weightSparsity=params["weight_sparsity"],
        weightSparsityCNN=params["weight_sparsity_cnn"],
        boostStrengthFactor=params["boost_strength_factor"],
        kInferenceFactor=params["k_inference_factor"],
        dropout=params["dropout"],
        useBatchNorm=params["use_batch_norm"],
        normalizeWeights=params.get("normalize_weights", False)
      )
    if torch.cuda.device_count() > 1:
      print("Using", torch.cuda.device_count(), "GPUs")
      sp_model = torch.nn.DataParallel(sp_model)

    self.model = sp_model.to(self.device)
    self.learningRate = params["learning_rate"]
    self.optimizer = self.createOptimizer(params, self.model)
    self.lr_scheduler = self.createLearningRateScheduler(params, self.optimizer)
1085437
def reset(self):
		
		self.clip = None
		self.loaded_file = None

		self.fps = None
		self.duration = None

		self.status = UNINITIALIZED
		self.clock.reset()

		self.loop_count = 0
1251460
public synchronized void resume() {
        if (!paused) {
            Util.w(TAG, "require resume this queue(remain " + taskList.size() + "), but it is"
                    + " still running");
            return;
        }
        paused = false;

        if (!taskList.isEmpty() && !looping) {
            looping = true;
            startNewLooper();
        }
    }
321607
def unpause(self):
        """"""
        res = librtmp.RTMP_Pause(self.client.rtmp, 0)

        if res < 1:
            raise RTMPError("Failed to unpause")
1248169
def resume(self):
        
        with self.readSharedFileStream('config.pickle') as fileHandle:
            config = safeUnpickleFromStream(fileHandle)
            assert config.workflowID is not None
            self.__config = config
1065933
def cmdloop(self, intro=None):
    """"""
    style = style_from_pygments(BasicStyle, style_dict)
    self.preloop()
    stop = None
    while not stop:
        line = prompt(get_prompt_tokens=get_prompt_tokens, lexer=lexer,
                      get_bottom_toolbar_tokens=get_bottom_toolbar_tokens,
                      history=history, style=style, true_color=True,
                      on_exit='return-none', on_abort='return-none',
                      completer=QCompleter())
        if line is None or line.strip() == r'\\':
            raise SystemExit
        else:
            line = self.precmd(line)
            stop = self.onecmd(line)
        stop = self.postcmd(stop, line)
    self.postloop()
828615
def resume(self, obj):
        """"""
        if isinstance(obj, str):
            savefile = open(obj, 'rb')
        else:
            savefile = obj
        game = pickle.loads(zlib.decompress(savefile.read()))
        if savefile is not obj:
            savefile.close()
        # Reinstate the random number generator.
        game.random_generator = random.Random()
        game.random_generator.setstate(game.random_state)
        del game.random_state
        return game
907288
async def resume(self):
        """"""

        self.logger.debug("resume command")

        if not self.state == 'ready':
            return

        if self.streamer is None:
            return

        try:
            if not self.streamer.is_playing():
                play_state = "Streaming" if self.is_live else "Playing"
                self.statuslog.info(play_state)
                self.streamer.resume()

                if self.pause_time is not None:
                    self.vclient_starttime += (self.vclient.loop.time() - self.pause_time)
                self.pause_time = None
        except Exception as e:
            logger.error(e)
            pass
546562
def wrap_with_rewind *io, &block
      io.each do |i|
        i.rewind
      end
      yield
      io.each do |i|
        i.rewind
      end
    end