Acquire "resources", wait until enough "resources" are acquired. For each loop,
        `limit` number of "resources" are permitted.
        
        :param use: number of "resouces" to be used.
        
        :return: True if is limited
420284
async def limit(self, use = 1):
        
        c = self._counter
        self._counter = c + use
        if self._task is None:
            self._task = self._container.subroutine(self._limiter_task(), False)
        if c >= self._bottom_line:
            # Limited
            await RateLimitingEvent.createMatcher(self, c // self._limit)
            return True
        else:
            return False
777412
def results(self, limit=100):
        
        limited = True if self.high_mark is not None else False
        rmax = self.high_mark - self.low_mark if limited else None
        rnum = 0

        params = self.get_params()
        params["offset"] = self.low_mark
        params["limit"] = limit

        while not limited and rmax is None or rnum < rmax:
            if limited or rmax is not None:
                rleft = rmax - rnum
                params["limit"] = rleft if rleft < limit else limit

            r = self.resource._meta.api.http_resource("GET", self.resource._meta.resource_name, params=params)
            data = self.resource._meta.api.resource_deserialize(r.text)

            if not limited:
                rmax = data["meta"]["total_count"]

            if data["meta"]["total_count"] < rmax:
                rmax = data["meta"]["total_count"]

            params["offset"] = data["meta"]["offset"] + data["meta"]["limit"]

            for item in data["objects"]:
                rnum += 1
                yield item
1068620
def resource(self, *resources):
        
        resources = tuple(self.resources) + resources
        return Resource(self.client, resources)
1243465
def take_until_including(condition):
    
    def take_until_including_(interable):
        for i in interable:
            if not condition(i):
                yield i
            else:
                yield i
                break
    return take_until_including_
1002007
def acquire(self) -> Connection:
        '''
        '''
        assert not self._closed

        yield from self._condition.acquire()

        while True:
            if self.ready:
                connection = self.ready.pop()
                break
            elif len(self.busy) < self.max_connections:
                connection = self._connection_factory()
                break
            else:
                yield from self._condition.wait()

        self.busy.add(connection)
        self._condition.release()

        return connection
541380
def busy(self):
        
        if self.handle.isexecuting():
            return True
        elif self.used_by is None:
            return False
        return not self.used_by() is None
431847
def resources(self):
        '''  '''
        used_resources = self._used_resources()
        ret = collections.defaultdict(dict)
        for resource, total in six.iteritems(self._resources):
            ret[resource]['total'] = total
            if resource in used_resources:
                ret[resource]['used'] = used_resources[resource]
            else:
                ret[resource]['used'] = 0
        return ret
1320213
def datalock(self, acquire=True):
        # type: (_BaseResumeManager) -> None
        
        if acquire:
            self._lock.acquire()
        try:
            yield
        finally:
            if acquire:
                self._lock.release()
171712
def set_file_limits(n):
    '''
    

    '''

    try:
        resource.setrlimit(resource.RLIMIT_NOFILE, (n, n))
        return True
    except ValueError:
        return False
203843
def get(self, **kwargs):
        ""
        kwargs.setdefault('limit', 1)
        return self._first(self.gather(**kwargs))
466769
protected void actionGoingToResources()
    {
        if (checker.canExtract())
        {
            for (final ExtractorListener listener : listeners)
            {
                listener.notifyStartExtraction(resourceType, resourceLocation);
            }
            state = ExtractorState.EXTRACTING;
        }
    }
320881
def limit(self, limit):
        

        if not isinstance(limit, int) or isinstance(limit, bool):
            raise InvalidUsage("limit size must be of type integer")

        self._sysparms['sysparm_limit'] = limit
565346
public boolean checkResources(Map<String, OrientPermission[]> resources, Action action)
	{
		for (Map.Entry<String, OrientPermission[]> entry : resources.entrySet()) {
			if(!checkResource(entry.getKey(), action, entry.getValue())) return false;
		}
		return true;
	}
1181767
async def is_locked(self, resource):
        

        successes = await asyncio.gather(*[
            i.is_locked(resource) for
            i in self.instances
        ], return_exceptions=True)
        successful_sets = sum(s is True for s in successes)

        locked = True if successful_sets >= int(len(self.instances) / 2) + 1 else False

        return locked
199324
def _make_resource(self):
        
        with self._lock:
            for i in self._unavailable_range():
                if self._reference_queue[i] is None:
                    rtracker = _ResourceTracker(
                        self._factory(**self._factory_arguments))

                    self._reference_queue[i] = rtracker
                    self._size += 1

                    return rtracker

            raise PoolFullError
985295
def resource(*args, loop=None, **kwargs):
    
    return _get_default_session(loop=loop).resource(*args, **kwargs)
953894
def _wait_non_ressources(self, callback):
        """"""  # noqa: E501
        self.trigger = threading.Lock()
        self.was_ended = False
        self.trigger.acquire()
        self.trigger.acquire()
        if not self.was_ended:
            callback(self)