neulab/docprompting-conala huggingface dataset:
coroutine acquire()  
Acquire a semaphore. If the internal counter is greater than zero, decrement it by one and return True immediately. If it is zero, wait until a release() is called and return True.
release()  
Release a semaphore, incrementing the internal counter by one. Can wake up a task waiting to acquire the semaphore. Unlike BoundedSemaphore, Semaphore allows making more release() calls than acquire() calls.
exception asyncio.SendfileNotAvailableError  
The “sendfile” syscall is not available for the given socket or file type. A subclass of RuntimeError.
class asyncio.Server  
Server objects are asynchronous context managers. When used in an async with statement, it’s guaranteed that the Server object is closed and not accepting new connections when the async with statement is completed: srv = await loop.create_server(...)

async with srv:
    # some code

# At this point, srv is closed and no longer accepts new connections.
  Changed in version 3.7: Server object is an asynchronous context manager since Python 3.7.   
close()  
Stop serving: close listening sockets and set the sockets attribute to None. The sockets that represent existing incoming client connections are left open. The server is closed asynchronously, use the wait_closed() coroutine to wait until the server is closed. 
  
get_loop()  
Return the event loop associated with the server object.  New in version 3.7.  
  
coroutine start_serving()  
Start accepting connections. This method is idempotent, so it can be called when the server is already being serving. The start_serving keyword-only parameter to loop.create_server() and asyncio.start_server() allows creating a Server object that is not accepting connections initially. In this case Server.start_serving(), or Server.serve_forever() can be used to make the Server start accepting connections.  New in version 3.7.  
  
coroutine serve_forever()  
Start accepting connections until the coroutine is cancelled. Cancellation of serve_forever task causes the server to be closed. This method can be called if the server is already accepting connections. Only one serve_forever task can exist per one Server object. Example: async def client_connected(reader, writer):
    # Communicate with the client with
    # reader/writer streams.  For example:
    await reader.readline()

async def main(host, port):
    srv = await asyncio.start_server(
        client_connected, host, port)
    await srv.serve_forever()

asyncio.run(main('127.0.0.1', 0))
  New in version 3.7.  
  
is_serving()  
Return True if the server is accepting new connections.  New in version 3.7.  
  
coroutine wait_closed()  
Wait until the close() method completes. 
  
sockets  
List of socket.socket objects the server is listening on.  Changed in version 3.7: Prior to Python 3.7 Server.sockets used to return an internal list of server sockets directly. In 3.7 a copy of that list is returned.
close()  
Stop serving: close listening sockets and set the sockets attribute to None. The sockets that represent existing incoming client connections are left open. The server is closed asynchronously, use the wait_closed() coroutine to wait until the server is closed.
get_loop()  
Return the event loop associated with the server object.  New in version 3.7.
is_serving()  
Return True if the server is accepting new connections.  New in version 3.7.
coroutine serve_forever()  
Start accepting connections until the coroutine is cancelled. Cancellation of serve_forever task causes the server to be closed. This method can be called if the server is already accepting connections. Only one serve_forever task can exist per one Server object. Example: async def client_connected(reader, writer):
    # Communicate with the client with
    # reader/writer streams.  For example:
    await reader.readline()

async def main(host, port):
    srv = await asyncio.start_server(
        client_connected, host, port)
    await srv.serve_forever()

asyncio.run(main('127.0.0.1', 0))
  New in version 3.7.
sockets  
List of socket.socket objects the server is listening on.  Changed in version 3.7: Prior to Python 3.7 Server.sockets used to return an internal list of server sockets directly. In 3.7 a copy of that list is returned.
coroutine start_serving()  
Start accepting connections. This method is idempotent, so it can be called when the server is already being serving. The start_serving keyword-only parameter to loop.create_server() and asyncio.start_server() allows creating a Server object that is not accepting connections initially. In this case Server.start_serving(), or Server.serve_forever() can be used to make the Server start accepting connections.  New in version 3.7.
asyncio.set_child_watcher(watcher)  
Set the current child watcher to watcher for the current policy. watcher must implement methods defined in the AbstractChildWatcher base class.
asyncio.set_event_loop(loop)  
Set loop as a current event loop for the current OS thread.
asyncio.set_event_loop_policy(policy)  
Set the current process-wide policy to policy. If policy is set to None, the default policy is restored.
awaitable asyncio.shield(aw, *, loop=None)  
Protect an awaitable object from being cancelled. If aw is a coroutine it is automatically scheduled as a Task. The statement: res = await shield(something())
 is equivalent to: res = await something()
 except that if the coroutine containing it is cancelled, the Task running in something() is not cancelled. From the point of view of something(), the cancellation did not happen. Although its caller is still cancelled, so the “await” expression still raises a CancelledError. If something() is cancelled by other means (i.e. from within itself) that would also cancel shield(). If it is desired to completely ignore cancellation (not recommended) the shield() function should be combined with a try/except clause, as follows: try:
    res = await shield(something())
except CancelledError:
    res = None
  Deprecated since version 3.8, will be removed in version 3.10: The loop parameter.
coroutine asyncio.sleep(delay, result=None, *, loop=None)  
Block for delay seconds. If result is provided, it is returned to the caller when the coroutine completes. sleep() always suspends the current task, allowing other tasks to run.  Deprecated since version 3.8, will be removed in version 3.10: The loop parameter.  Example of coroutine displaying the current date every second for 5 seconds: import asyncio
import datetime

async def display_date():
    loop = asyncio.get_running_loop()
    end_time = loop.time() + 5.0
    while True:
        print(datetime.datetime.now())
        if (loop.time() + 1.0) >= end_time:
            break
        await asyncio.sleep(1)

asyncio.run(display_date())
coroutine asyncio.start_server(client_connected_cb, host=None, port=None, *, loop=None, limit=None, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, start_serving=True)  
Start a socket server. The client_connected_cb callback is called whenever a new client connection is established. It receives a (reader, writer) pair as two arguments, instances of the StreamReader and StreamWriter classes. client_connected_cb can be a plain callable or a coroutine function; if it is a coroutine function, it will be automatically scheduled as a Task. The loop argument is optional and can always be determined automatically when this method is awaited from a coroutine. limit determines the buffer size limit used by the returned StreamReader instance. By default the limit is set to 64 KiB. The rest of the arguments are passed directly to loop.create_server().  New in version 3.7: The ssl_handshake_timeout and start_serving parameters.
coroutine asyncio.start_unix_server(client_connected_cb, path=None, *, loop=None, limit=None, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, start_serving=True)  
Start a Unix socket server. Similar to start_server() but works with Unix sockets. See also the documentation of loop.create_unix_server(). Availability: Unix.  New in version 3.7: The ssl_handshake_timeout and start_serving parameters.   Changed in version 3.7: The path parameter can now be a path-like object.
class asyncio.StreamReader  
Represents a reader object that provides APIs to read data from the IO stream. It is not recommended to instantiate StreamReader objects directly; use open_connection() and start_server() instead.  
coroutine read(n=-1)  
Read up to n bytes. If n is not provided, or set to -1, read until EOF and return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. 
  
coroutine readline()  
Read one line, where “line” is a sequence of bytes ending with \n. If EOF is received and \n was not found, the method returns partially read data. If EOF is received and the internal buffer is empty, return an empty bytes object. 
  
coroutine readexactly(n)  
Read exactly n bytes. Raise an IncompleteReadError if EOF is reached before n can be read. Use the IncompleteReadError.partial attribute to get the partially read data. 
  
coroutine readuntil(separator=b'\n')  
Read data from the stream until separator is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. If the amount of data read exceeds the configured stream limit, a LimitOverrunError exception is raised, and the data is left in the internal buffer and can be read again. If EOF is reached before the complete separator is found, an IncompleteReadError exception is raised, and the internal buffer is reset. The IncompleteReadError.partial attribute may contain a portion of the separator.  New in version 3.5.2.  
  
at_eof()  
Return True if the buffer is empty and feed_eof() was called.
at_eof()  
Return True if the buffer is empty and feed_eof() was called.
coroutine read(n=-1)  
Read up to n bytes. If n is not provided, or set to -1, read until EOF and return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object.
coroutine readexactly(n)  
Read exactly n bytes. Raise an IncompleteReadError if EOF is reached before n can be read. Use the IncompleteReadError.partial attribute to get the partially read data.
coroutine readline()  
Read one line, where “line” is a sequence of bytes ending with \n. If EOF is received and \n was not found, the method returns partially read data. If EOF is received and the internal buffer is empty, return an empty bytes object.
coroutine readuntil(separator=b'\n')  
Read data from the stream until separator is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. If the amount of data read exceeds the configured stream limit, a LimitOverrunError exception is raised, and the data is left in the internal buffer and can be read again. If EOF is reached before the complete separator is found, an IncompleteReadError exception is raised, and the internal buffer is reset. The IncompleteReadError.partial attribute may contain a portion of the separator.  New in version 3.5.2.
class asyncio.StreamWriter  
Represents a writer object that provides APIs to write data to the IO stream. It is not recommended to instantiate StreamWriter objects directly; use open_connection() and start_server() instead.  
write(data)  
The method attempts to write the data to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent. The method should be used along with the drain() method: stream.write(data)
await stream.drain()
 
  
writelines(data)  
The method writes a list (or any iterable) of bytes to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent. The method should be used along with the drain() method: stream.writelines(lines)
await stream.drain()
 
  
close()  
The method closes the stream and the underlying socket. The method should be used along with the wait_closed() method: stream.close()
await stream.wait_closed()
 
  
can_write_eof()  
Return True if the underlying transport supports the write_eof() method, False otherwise. 
  
write_eof()  
Close the write end of the stream after the buffered write data is flushed. 
  
transport  
Return the underlying asyncio transport. 
  
get_extra_info(name, default=None)  
Access optional transport information; see BaseTransport.get_extra_info() for details. 
  
coroutine drain()  
Wait until it is appropriate to resume writing to the stream. Example: writer.write(data)
await writer.drain()
 This is a flow control method that interacts with the underlying IO write buffer. When the size of the buffer reaches the high watermark, drain() blocks until the size of the buffer is drained down to the low watermark and writing can be resumed. When there is nothing to wait for, the drain() returns immediately. 
  
is_closing()  
Return True if the stream is closed or in the process of being closed.  New in version 3.7.  
  
coroutine wait_closed()  
Wait until the stream is closed. Should be called after close() to wait until the underlying connection is closed.  New in version 3.7.
can_write_eof()  
Return True if the underlying transport supports the write_eof() method, False otherwise.
close()  
The method closes the stream and the underlying socket. The method should be used along with the wait_closed() method: stream.close()
await stream.wait_closed()
coroutine drain()  
Wait until it is appropriate to resume writing to the stream. Example: writer.write(data)
await writer.drain()
 This is a flow control method that interacts with the underlying IO write buffer. When the size of the buffer reaches the high watermark, drain() blocks until the size of the buffer is drained down to the low watermark and writing can be resumed. When there is nothing to wait for, the drain() returns immediately.
get_extra_info(name, default=None)  
Access optional transport information; see BaseTransport.get_extra_info() for details.
is_closing()  
Return True if the stream is closed or in the process of being closed.  New in version 3.7.
coroutine wait_closed()  
Wait until the stream is closed. Should be called after close() to wait until the underlying connection is closed.  New in version 3.7.
write(data)  
The method attempts to write the data to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent. The method should be used along with the drain() method: stream.write(data)
await stream.drain()
writelines(data)  
The method writes a list (or any iterable) of bytes to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent. The method should be used along with the drain() method: stream.writelines(lines)
await stream.drain()
write_eof()  
Close the write end of the stream after the buffered write data is flushed.
class asyncio.SubprocessProtocol(BaseProtocol)  
The base class for implementing protocols communicating with child processes (unidirectional pipes).
SubprocessProtocol.pipe_connection_lost(fd, exc)  
Called when one of the pipes communicating with the child process is closed. fd is the integer file descriptor that was closed.
SubprocessProtocol.pipe_data_received(fd, data)  
Called when the child process writes data into its stdout or stderr pipe. fd is the integer file descriptor of the pipe. data is a non-empty bytes object containing the received data.
SubprocessProtocol.process_exited()  
Called when the child process has exited.
class asyncio.SubprocessTransport(BaseTransport)  
An abstraction to represent a connection between a parent and its child OS process. Instances of the SubprocessTransport class are returned from event loop methods loop.subprocess_shell() and loop.subprocess_exec().
SubprocessTransport.close()  
Kill the subprocess by calling the kill() method. If the subprocess hasn’t returned yet, and close transports of stdin, stdout, and stderr pipes.
SubprocessTransport.get_pipe_transport(fd)  
Return the transport for the communication pipe corresponding to the integer file descriptor fd:  
0: readable streaming transport of the standard input (stdin), or None if the subprocess was not created with stdin=PIPE
 
1: writable streaming transport of the standard output (stdout), or None if the subprocess was not created with stdout=PIPE
 
2: writable streaming transport of the standard error (stderr), or None if the subprocess was not created with stderr=PIPE
 other fd: None
SubprocessTransport.get_returncode()  
Return the subprocess return code as an integer or None if it hasn’t returned, which is similar to the subprocess.Popen.returncode attribute.
SubprocessTransport.kill()  
Kill the subprocess. On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, this method is an alias for terminate(). See also subprocess.Popen.kill().
SubprocessTransport.send_signal(signal)  
Send the signal number to the subprocess, as in subprocess.Popen.send_signal().
SubprocessTransport.terminate()  
Stop the subprocess. On POSIX systems, this method sends SIGTERM to the subprocess. On Windows, the Windows API function TerminateProcess() is called to stop the subprocess. See also subprocess.Popen.terminate().
add_done_callback(callback, *, context=None)  
Add a callback to be run when the Task is done. This method should only be used in low-level callback-based code. See the documentation of Future.add_done_callback() for more details.
cancel(msg=None)  
Request the Task to be cancelled. This arranges for a CancelledError exception to be thrown into the wrapped coroutine on the next cycle of the event loop. The coroutine then has a chance to clean up or even deny the request by suppressing the exception with a try … … except CancelledError … finally block. Therefore, unlike Future.cancel(), Task.cancel() does not guarantee that the Task will be cancelled, although suppressing cancellation completely is not common and is actively discouraged.  Changed in version 3.9: Added the msg parameter.  The following example illustrates how coroutines can intercept the cancellation request: async def cancel_me():
    print('cancel_me(): before sleep')

    try:
        # Wait for 1 hour
        await asyncio.sleep(3600)
    except asyncio.CancelledError:
        print('cancel_me(): cancel sleep')
        raise
    finally:
        print('cancel_me(): after sleep')

async def main():
    # Create a "cancel_me" Task
    task = asyncio.create_task(cancel_me())

    # Wait for 1 second
    await asyncio.sleep(1)

    task.cancel()
    try:
        await task
    except asyncio.CancelledError:
        print("main(): cancel_me is cancelled now")

asyncio.run(main())

# Expected output:
#
#     cancel_me(): before sleep
#     cancel_me(): cancel sleep
#     cancel_me(): after sleep
#     main(): cancel_me is cancelled now
cancelled()  
Return True if the Task is cancelled. The Task is cancelled when the cancellation was requested with cancel() and the wrapped coroutine propagated the CancelledError exception thrown into it.
done()  
Return True if the Task is done. A Task is done when the wrapped coroutine either returned a value, raised an exception, or the Task was cancelled.
exception()  
Return the exception of the Task. If the wrapped coroutine raised an exception that exception is returned. If the wrapped coroutine returned normally this method returns None. If the Task has been cancelled, this method raises a CancelledError exception. If the Task isn’t done yet, this method raises an InvalidStateError exception.
get_coro()  
Return the coroutine object wrapped by the Task.  New in version 3.8.
get_name()  
Return the name of the Task. If no name has been explicitly assigned to the Task, the default asyncio Task implementation generates a default name during instantiation.  New in version 3.8.
get_stack(*, limit=None)  
Return the list of stack frames for this Task. If the wrapped coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames. The frames are always ordered from oldest to newest. Only one stack frame is returned for a suspended coroutine. The optional limit argument sets the maximum number of frames to return; by default all available frames are returned. The ordering of the returned list differs depending on whether a stack or a traceback is returned: the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)
print_stack(*, limit=None, file=None)  
Print the stack or traceback for this Task. This produces output similar to that of the traceback module for the frames retrieved by get_stack(). The limit argument is passed to get_stack() directly. The file argument is an I/O stream to which the output is written; by default output is written to sys.stderr.
remove_done_callback(callback)  
Remove callback from the callbacks list. This method should only be used in low-level callback-based code. See the documentation of Future.remove_done_callback() for more details.
result()  
Return the result of the Task. If the Task is done, the result of the wrapped coroutine is returned (or if the coroutine raised an exception, that exception is re-raised.) If the Task has been cancelled, this method raises a CancelledError exception. If the Task’s result isn’t yet available, this method raises a InvalidStateError exception.
set_name(value)  
Set the name of the Task. The value argument can be any object, which is then converted to a string. In the default Task implementation, the name will be visible in the repr() output of a task object.  New in version 3.8.
class asyncio.ThreadedChildWatcher  
This implementation starts a new waiting thread for every subprocess spawn. It works reliably even when the asyncio event loop is run in a non-main OS thread. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates), but starting a thread per process requires extra memory. This watcher is used by default.  New in version 3.8.
exception asyncio.TimeoutError  
The operation has exceeded the given deadline.  Important This exception is different from the builtin TimeoutError exception.
class asyncio.TimerHandle  
A callback wrapper object returned by loop.call_later(), and loop.call_at(). This class is a subclass of Handle.  
when()  
Return a scheduled callback time as float seconds. The time is an absolute timestamp, using the same time reference as loop.time().  New in version 3.7.
when()  
Return a scheduled callback time as float seconds. The time is an absolute timestamp, using the same time reference as loop.time().  New in version 3.7.