def __iter__(self): iterator = wait(self.client.__aiter__()) while True: try: yield wait(iterator.__anext__()) except StopAsyncIteration: break
def __call__(self, message): connection = greenio.wait(self.pool.connect()) with connection: consumer = connection.current_consumer() consumer.start(message) result = greenio.wait(consumer.on_finished) return consumer if self.full_response else consumer.buffer
def __call__(self, message): connection = greenio.wait(self.pool.connect()) with connection: consumer = connection.current_consumer() consumer.start(message) greenio.wait(consumer.on_finished) return consumer if self.full_response else consumer.buffer
def _database_create(self, engine, dbname): if isinstance(engine, Store): return wait(engine.database_create(dbname)) elif engine.name != 'sqlite': conn = engine.connect() # the connection will still be inside a transaction, # so we have to end the open transaction with a commit conn.execute("commit") conn.execute('create database %s' % dbname) conn.close() url = copy(engine.url) url.database = dbname return str(url)
def close(self): for engine in self.engines(): wait(engine.close())
def database_drop(self, **params): for engine in self.engines(): wait(engine.database_drop(**params))
def _new_ssl_conn(self): """ Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ return wait(_ssl_connect(self))
def commit(self, transaction): return wait(super().commit(transaction))
def table_drop(self): return wait(super().table_drop())
def table_create(self, remove_existing=False): return wait(super().table_create(remove_existing))
def green_request(request, method, url, **params): return greenio.wait(request(method, url, **params))
def readinto(self, b): return wait(self._readinto(b))
def read(self, len=0): return wait(self._sock._stream_reader.read(len))
def readline(self, len=0): return wait(self._sock._stream_reader.readline())
def __call__(self, *args, **kwargs): return wait(self._wrap_body(args, kwargs))
def example(loop): wait(callback) loop.stop()
def __call__(self, *args, **kw): return wait(self._callable(*args, **kw))
def __iter__(self): for data in self.client: yield wait(data)
def __call__(self, message): return greenio.wait(super().__call__(message))
def wsgi_request_from_app(app, **kw): request = wait(test_wsgi_request(**kw)) app.on_request(request) return request