Delay loading of h5py until it is needed
342851
def _load_h5(filename):
    ''''''
    from neurom.io import hdf5
    return hdf5.read(filename,
                     remove_duplicates=False,
                     data_wrapper=DataWrapper)
1075085
def _wait_for_handles(handles, timeout=-1):
    
    arrtype = HANDLE * len(handles)
    handle_array = arrtype(*handles)

    ret = windll.kernel32.WaitForMultipleObjects(
        len(handle_array), handle_array, BOOL(False), DWORD(timeout))

    if ret == WAIT_TIMEOUT:
        return None
    else:
        h = handle_array[ret]
        return h
617209
public void waitForReady() {
        if (!isLoaded) {
            synchronized (LOAD_LOCK) {
                if (!isLoaded) {
                    try {
                        long start = Runtime.getActorTime();
                        LOAD_LOCK.wait();
                        Log.d(TAG, "Waited for startup in " + (Runtime.getActorTime() - start) + " ms");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
1069420
def EnableFreeAPIKeyRateLimit(self):
    
    self._analyzer.hashes_per_batch = 4
    self._analyzer.wait_after_analysis = 60
    self._analysis_queue_timeout = self._analyzer.wait_after_analysis + 1
1295822
def _wait(jid):
    '''
    
    '''
    if jid is None:
        jid = salt.utils.jid.gen_jid(__opts__)
    states = _prior_running_states(jid)
    while states:
        time.sleep(1)
        states = _prior_running_states(jid)
1270076
function ready () {

    var hash = location.hash.substr( 1 );
    if(hash !=='') demoName = hash;
    editor.load('demos/' + demoName + '.js');

}
1356116
def _on_startup(self, *args):
        
        yield from Controller.instance().start()
        # Because with a large image collection
        # without md5sum already computed we start the
        # computing with server start
        asyncio.async(Qemu.instance().list_images())
196950
def wait_for_deps(self, conf, images):
        """"""
        from harpoon.option_spec.image_objs import WaitCondition
        api = conf.harpoon.docker_context_maker().api

        waited = set()
        last_attempt = {}
        dependencies = set(dep for dep, _ in conf.dependency_images())

        # Wait conditions come from dependency_options first
        # Or if none specified there, they come from the image itself
        wait_conditions = {}
        for dependency in dependencies:
            if conf.dependency_options is not NotSpecified and dependency in conf.dependency_options and conf.dependency_options[dependency].wait_condition is not NotSpecified:
                wait_conditions[dependency] = conf.dependency_options[dependency].wait_condition
            elif images[dependency].wait_condition is not NotSpecified:
                wait_conditions[dependency] = images[dependency].wait_condition

        if not wait_conditions:
            return

        start = time.time()
        while True:
            this_round = []
            for dependency in dependencies:
                if dependency in waited:
                    continue

                image = images[dependency]
                if dependency in wait_conditions:
                    done = self.wait_for_dep(api, image, wait_conditions[dependency], start, last_attempt.get(dependency))
                    this_round.append(done)
                    if done is True:
                        waited.add(dependency)
                    elif done is False:
                        last_attempt[dependency] = time.time()
                    elif done is WaitCondition.Timedout:
                        log.warning("Stopping dependency because it timedout waiting\tcontainer_id=%s", image.container_id)
                        self.stop_container(image)
                else:
                    waited.add(dependency)

            if set(this_round) != set([WaitCondition.KeepWaiting]):
                if dependencies - waited == set():
                    log.info("Finished waiting for dependencies")
                    break
                else:
                    log.info("Still waiting for dependencies\twaiting_on=%s", list(dependencies-waited))

                couldnt_wait = set()
                container_ids = {}
                for dependency in dependencies:
                    if dependency in waited:
                        continue

                    image = images[dependency]
                    if image.container_id is None:
                        stopped = True
                        if dependency not in container_ids:
                            available = sorted([i for i in available if "/{0}".format(image.container_name) in i["Names"]], key=lambda i: i["Created"])
                            if available:
                                container_ids[dependency] = available[0]["Id"]
                    else:
                        if dependency not in container_ids:
                            container_ids[dependency] = image.container_id
                        stopped, _ = self.is_stopped(image, image.container_id)

                    if stopped:
                        couldnt_wait.add(dependency)

                if couldnt_wait:
                    for container in couldnt_wait:
                        if container not in images or container not in container_ids:
                            continue
                        image = images[container]
                        container_id = container_ids[container]
                        container_name = image.container_name
                        hp.write_to(conf.harpoon.stdout, "=================== Logs for failed container {0} ({1})\n".format(container_id, container_name))
                        for line in conf.harpoon.docker_api.logs(container_id).split("\n"):
                            hp.write_to(conf.harpoon.stdout, "{0}\n".format(line))
                        hp.write_to(conf.harpoon.stdout, "------------------- End logs for failed container\n")
                    raise BadImage("One or more of the dependencies stopped running whilst waiting for other dependencies", stopped=list(couldnt_wait))

            time.sleep(0.1)
1207751
def _set_process_async(process):
    """"""
    for fd in [process.stderr.fileno(), process.stdout.fileno()]:
        fl = fcntl.fcntl(fd, fcntl.F_GETFL)
        fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
1071779
def _load_data(filepath):
  """"""
  with h5py.File(filepath, "r") as h5dataset:
    image_array = np.array(h5dataset["images"])
    # The 'label' data set in the hdf5 file actually contains the float values
    # and not the class labels.
    values_array = np.array(h5dataset["labels"])
  return image_array, values_array
530432
def wait_for_compactions(self, timeout=600):
        
        for node in list(self.nodes.values()):
            if node.is_running():
                node.wait_for_compactions(timeout)
        return self
348865
def _delay_for_ratelimits(cls, start):
        """"""
        stop = datetime.now()
        duration_microseconds = (stop - start).microseconds
        if duration_microseconds < cls.REQUEST_TIME_MICROSECONDS:
            time.sleep((cls.REQUEST_TIME_MICROSECONDS - duration_microseconds)
                       / MICROSECONDS_PER_SECOND)
109647
def _wait(self, args, now, cap, consumed_history, consumed_capacity):
        
        for key in ['read', 'write']:
            if key in cap and cap[key] > 0:
                consumed_history[key].add(now, consumed_capacity[key])
                consumed = consumed_history[key].value
                if consumed > 0 and consumed >= cap[key]:
                    seconds = math.ceil(float(consumed) / cap[key])
                    LOG.debug("Rate limited throughput exceeded. Sleeping "
                              "for %d seconds.", seconds)
                    if callable(self.callback):
                        callback_args = args + (seconds,)
                        if self.callback(*callback_args):
                            continue
                    time.sleep(seconds)
511525
def delay(self, dl=0):
        
        if dl is None:
            time.sleep(self.dl)
        elif dl < 0:
            sys.stderr.write(
                "delay cannot less than zero, this takes no effects.\n")
        else:
            time.sleep(dl)
1140917
function delayLoading (args) {
        ariaCoreTimer.addCallback({
            fn : resourcesHandlerLoaded,
            args : args,
            scope : {},
            delay : 12
        });
    }
1110528
def _wait_for_result(self):
        """"""
        basetime = 0.018 if self._low_res else 0.128
        sleep(basetime * (self._mtreg / 69.0) + self._delay)
239191
function waitForReady (method) {
  return function fetchSync_readyWrapper (...args) {
    if (hasStartedInit) return ready.promise.then(() => method(...args))
    throw new Error('initialise first with fetchSync.init()')
  }
}