Reset the environment.

    Args:
      blocking: Whether to wait for the result.

    Returns:
      New observation when blocking, otherwise callable that returns the new
      observation.
428599
def reset(self, blocking=True):
    
    promise = self.call('reset')
    if blocking:
      return promise()
    else:
      return promise
591318
def acquire(self, blocking=True, timeout=-1):
        """"""
        if not isinstance(timeout, (int, float)):
            raise TypeError('a float is required')

        if blocking:
            # blocking indefinite
            if timeout == -1:
                with self.__condition:
                    while not self.__lock.acquire(False):
                        # condition with timeout is interruptable
                        self.__condition.wait(60)
                return True

            # same as non-blocking
            elif timeout == 0:
                return self.__lock.acquire(False)

            elif timeout < 0:
                raise ValueError('timeout value must be strictly positive (or -1)')

            # blocking finite
            else:
                start = time()
                waited_time = 0
                with self.__condition:
                    while waited_time < timeout:
                        if self.__lock.acquire(False):
                            return True
                        else:
                            self.__condition.wait(timeout - waited_time)
                            waited_time = time() - start
                return False

        elif timeout != -1:
            raise ValueError('can\'t specify a timeout for a non-blocking call')

        else:
            # non-blocking
            return self.__lock.acquire(False)
240718
def block(self):
        """"""
        if self._uses_subprocess:
            # consume stdout and stderr
            try:
                stdout, stderr = self.subprocess.communicate()
                self.__out = stdout
                self.__err = stderr
            except ValueError:
                pass  # Don't read from finished subprocesses.
        else:
            self.subprocess.wait()
1121511
def reset(self):
        # pylint: disable=not-context-manager
        
        logger.info("Scheduling loop reset")
        with self.waiting_results.mutex:
            self.waiting_results.queue.clear()
        self.checks.clear()
        self.actions.clear()
1210842
def setblocking(self, blocking):
        ''''''
        for sock in self.socket():
            sock.setblocking(blocking)
            self._blocking = blocking
446430
private void blockingRefresh() {
        try {
            if (blockingRefreshLock
                    .tryLock(BLOCKING_REFRESH_MAX_WAIT_IN_SECONDS, TimeUnit.SECONDS)) {
                try {
                    // Return if successful refresh occurred while waiting for the lock
                    if (!shouldDoBlockingRefresh()) {
                        return;
                    } else {
                        // Otherwise do a synchronous refresh if the last lock holder was unable to
                        // refresh the value
                        refreshValue();
                        return;
                    }
                } finally {
                    blockingRefreshLock.unlock();
                }
            }
        } catch (InterruptedException ex) {
            handleInterruptedException("Interrupted waiting to refresh the value.", ex);
        }
        // Couldn't acquire the lock. Just try a synchronous refresh
        refreshValue();
    }
251453
def refresh(self):
        
        self._screen.block_transfer(self._buffer, self._dx, self._dy)
1071616
def read_blocking(self):
        
        while True:
            data = self._read()
            if data != None:
                break

        return self._parse_message(data)
836570
def reload(self, result=None):
        

        if result is None:
            result = self._client._get(
                self.__class__.base_url(
                    self.sys['space'].id,
                    self.sys['id'],
                    environment_id=self._environment_id
                )
            )

        self._update_from_resource(result)

        return self
637623
def on_connection_unblocked(self, method_frame):
        
        LOGGER.debug('Connection unblocked: %r', method_frame)
        self.state = self.STATE_READY
        if self.on_ready:
            self.on_ready(self)
38145
def block_call (context, &block)
      args = []
      block.parameters.each do |parameter|
        args << context[parameter[1]]
      end
      block.call(*args)
    end
343365
protected void restoreBlock(RestoreWork rejoinWork, SiteProcedureConnection siteConnection)
    {
        kickWatchdog(true);
        rejoinWork.restore(siteConnection);
    }
651038
def start(self, blocking=False):
        
        self.debug("()")
        super(SensorClient, self).start(blocking=False)
        try:
            a_thread = threading.Thread(
                target=self._thread_wrapper,
                args=(self._packet_loop,)
            )
            a_thread.daemon = True
            a_thread.start()
        except:
            self.exception("Failed to run packet loop")
            raise SensorStartException("Packet loop failed")
        self.info("Started")
        # Blocking - call StartStopable.start
        super(Sensor, self).start(blocking)
870854
def reset(self):
        
        logger.debug("{}'s Monitor being reset".format(self))
        instances_ids = self.instances.started.keys()
        self.numOrderedRequests = {inst_id: (0, 0) for inst_id in instances_ids}
        self.requestTracker.reset()
        self.masterReqLatencies = {}
        self.masterReqLatencyTooHigh = False
        self.totalViewChanges += 1
        self.lastKnownTraffic = self.calculateTraffic()
        if self.acc_monitor:
            self.acc_monitor.reset()
        for i in instances_ids:
            rm = self.create_throughput_measurement(self.config)
            self.throughputs[i] = rm
            lm = self.latency_measurement_cls(self.config)
            self.clientAvgReqLatencies[i] = lm
959195
def setBlockRequested(blockInfo, bool)
      if bool
        @requestedBlocks.set blockInfo.blockIndex
      else
        @requestedBlocks.clear blockInfo.blockIndex
      end
    end
1222915
def restart(self, timeout=None, task=None, block_callbacks=False, role=None):
        
        self.set_state('restarting')
        if not block_callbacks:
            self.__cb_pending = ACTION_ON_RESTART
        ret = self.stop(block_callbacks=True) and self.start(timeout, task, True, role)
        if not ret and not self.is_starting():
            self.set_state('restart failed ({0})'.format(self.state))
        return ret
1003051
def reset(self, **kwargs):
    
    self.env.reset(**kwargs)
    if self.override_num_noops is not None:
      noops = self.override_num_noops
    else:
      noops = self.unwrapped.np_random.randint(1, self.noop_max + 1)  # pylint: disable=E1101
    assert noops > 0
    obs = None
    for _ in range(noops):
      obs, _, done, _ = self.env.step(self.noop_action)
      if done:
        obs = self.env.reset(**kwargs)
    return obs