Exemple #1
0
 def __iter__(self):
     iterator = wait(self.client.__aiter__())
     while True:
         try:
             yield wait(iterator.__anext__())
         except StopAsyncIteration:
             break
Exemple #2
0
 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
Exemple #3
0
 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
Exemple #4
0
 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)
Exemple #5
0
 def close(self):
     for engine in self.engines():
         wait(engine.close())
Exemple #6
0
 def database_drop(self, **params):
     for engine in self.engines():
         wait(engine.database_drop(**params))
Exemple #7
0
def _new_ssl_conn(self):
    """ Establish a socket connection and set nodelay settings on it.

    :return: New socket connection.
    """
    return wait(_ssl_connect(self))
Exemple #8
0
 def database_drop(self, **params):
     for engine in self.engines():
         wait(engine.database_drop(**params))
Exemple #9
0
 def commit(self, transaction):
     return wait(super().commit(transaction))
Exemple #10
0
 def table_drop(self):
     return wait(super().table_drop())
Exemple #11
0
 def table_create(self, remove_existing=False):
     return wait(super().table_create(remove_existing))
Exemple #12
0
def green_request(request, method, url, **params):
    return greenio.wait(request(method, url, **params))
Exemple #13
0
 def readinto(self, b):
     return wait(self._readinto(b))
Exemple #14
0
 def read(self, len=0):
     return wait(self._sock._stream_reader.read(len))
Exemple #15
0
 def readline(self, len=0):
     return wait(self._sock._stream_reader.readline())
Exemple #16
0
 def __call__(self, *args, **kwargs):
     return wait(self._wrap_body(args, kwargs))
Exemple #17
0
def example(loop):
    wait(callback)
    loop.stop()
Exemple #18
0
 def __call__(self, *args, **kw):
     return wait(self._callable(*args, **kw))
Exemple #19
0
 def close(self):
     for engine in self.engines():
         wait(engine.close())
Exemple #20
0
 def __iter__(self):
     for data in self.client:
         yield wait(data)
Exemple #21
0
 def __call__(self, message):
     return greenio.wait(super().__call__(message))
Exemple #22
0
def wsgi_request_from_app(app, **kw):
    request = wait(test_wsgi_request(**kw))
    app.on_request(request)
    return request