neulab/docprompting-conala huggingface dataset:
runpy.run_module(mod_name, init_globals=None, run_name=None, alter_sys=False)  
Execute the code of the specified module and return the resulting module globals dictionary. The module’s code is first located using the standard import mechanism (refer to PEP 302 for details) and then executed in a fresh module namespace. The mod_name argument should be an absolute module name. If the module name refers to a package rather than a normal module, then that package is imported and the __main__ submodule within that package is then executed and the resulting module globals dictionary returned. The optional dictionary argument init_globals may be used to pre-populate the module’s globals dictionary before the code is executed. The supplied dictionary will not be modified. If any of the special global variables below are defined in the supplied dictionary, those definitions are overridden by run_module(). The special global variables __name__, __spec__, __file__, __cached__, __loader__ and __package__ are set in the globals dictionary before the module code is executed (Note that this is a minimal set of variables - other variables may be set implicitly as an interpreter implementation detail). __name__ is set to run_name if this optional argument is not None, to mod_name + '.__main__' if the named module is a package and to the mod_name argument otherwise. __spec__ will be set appropriately for the actually imported module (that is, __spec__.name will always be mod_name or mod_name + '.__main__, never run_name). __file__, __cached__, __loader__ and __package__ are set as normal based on the module spec. If the argument alter_sys is supplied and evaluates to True, then sys.argv[0] is updated with the value of __file__ and sys.modules[__name__] is updated with a temporary module object for the module being executed. Both sys.argv[0] and sys.modules[__name__] are restored to their original values before the function returns. Note that this manipulation of sys is not thread-safe. Other threads may see the partially initialised module, as well as the altered list of arguments. It is recommended that the sys module be left alone when invoking this function from threaded code.  See also The -m option offering equivalent functionality from the command line.   Changed in version 3.1: Added ability to execute packages by looking for a __main__ submodule.   Changed in version 3.2: Added __cached__ global variable (see PEP 3147).   Changed in version 3.4: Updated to take advantage of the module spec feature added by PEP 451. This allows __cached__ to be set correctly for modules run this way, as well as ensuring the real module name is always accessible as __spec__.name.
runpy.run_path(file_path, init_globals=None, run_name=None)  
Execute the code at the named filesystem location and return the resulting module globals dictionary. As with a script name supplied to the CPython command line, the supplied path may refer to a Python source file, a compiled bytecode file or a valid sys.path entry containing a __main__ module (e.g. a zipfile containing a top-level __main__.py file). For a simple script, the specified code is simply executed in a fresh module namespace. For a valid sys.path entry (typically a zipfile or directory), the entry is first added to the beginning of sys.path. The function then looks for and executes a __main__ module using the updated path. Note that there is no special protection against invoking an existing __main__ entry located elsewhere on sys.path if there is no such module at the specified location. The optional dictionary argument init_globals may be used to pre-populate the module’s globals dictionary before the code is executed. The supplied dictionary will not be modified. If any of the special global variables below are defined in the supplied dictionary, those definitions are overridden by run_path(). The special global variables __name__, __spec__, __file__, __cached__, __loader__ and __package__ are set in the globals dictionary before the module code is executed (Note that this is a minimal set of variables - other variables may be set implicitly as an interpreter implementation detail). __name__ is set to run_name if this optional argument is not None and to '<run_path>' otherwise. If the supplied path directly references a script file (whether as source or as precompiled byte code), then __file__ will be set to the supplied path, and __spec__, __cached__, __loader__ and __package__ will all be set to None. If the supplied path is a reference to a valid sys.path entry, then __spec__ will be set appropriately for the imported __main__ module (that is, __spec__.name will always be __main__). __file__, __cached__, __loader__ and __package__ will be set as normal based on the module spec. A number of alterations are also made to the sys module. Firstly, sys.path may be altered as described above. sys.argv[0] is updated with the value of file_path and sys.modules[__name__] is updated with a temporary module object for the module being executed. All modifications to items in sys are reverted before the function returns. Note that, unlike run_module(), the alterations made to sys are not optional in this function as these adjustments are essential to allowing the execution of sys.path entries. As the thread-safety limitations still apply, use of this function in threaded code should be either serialised with the import lock or delegated to a separate process.  See also Interface options for equivalent functionality on the command line (python path/to/script).   New in version 3.2.   Changed in version 3.4: Updated to take advantage of the module spec feature added by PEP 451. This allows __cached__ to be set correctly in the case where __main__ is imported from a valid sys.path entry rather than being executed directly.
exception RuntimeError  
Raised when an error is detected that doesn’t fall in any of the other categories. The associated value is a string indicating what precisely went wrong.
class sched.scheduler(timefunc=time.monotonic, delayfunc=time.sleep)  
The scheduler class defines a generic interface to scheduling events. It needs two functions to actually deal with the “outside world” — timefunc should be callable without arguments, and return a number (the “time”, in any units whatsoever). The delayfunc function should be callable with one argument, compatible with the output of timefunc, and should delay that many time units. delayfunc will also be called with the argument 0 after each event is run to allow other threads an opportunity to run in multi-threaded applications.  Changed in version 3.3: timefunc and delayfunc parameters are optional.   Changed in version 3.3: scheduler class can be safely used in multi-threaded environments.
scheduler.cancel(event)  
Remove the event from the queue. If event is not an event currently in the queue, this method will raise a ValueError.
scheduler.enter(delay, priority, action, argument=(), kwargs={})  
Schedule an event for delay more time units. Other than the relative time, the other arguments, the effect and the return value are the same as those for enterabs().  Changed in version 3.3: argument parameter is optional.   Changed in version 3.3: kwargs parameter was added.
scheduler.enterabs(time, priority, action, argument=(), kwargs={})  
Schedule a new event. The time argument should be a numeric type compatible with the return value of the timefunc function passed to the constructor. Events scheduled for the same time will be executed in the order of their priority. A lower number represents a higher priority. Executing the event means executing action(*argument, **kwargs). argument is a sequence holding the positional arguments for action. kwargs is a dictionary holding the keyword arguments for action. Return value is an event which may be used for later cancellation of the event (see cancel()).  Changed in version 3.3: argument parameter is optional.   Changed in version 3.3: kwargs parameter was added.
scheduler.queue  
Read-only attribute returning a list of upcoming events in the order they will be run. Each event is shown as a named tuple with the following fields: time, priority, action, argument, kwargs.
scheduler.run(blocking=True)  
Run all scheduled events. This method will wait (using the delayfunc() function passed to the constructor) for the next event, then execute it and so on until there are no more scheduled events. If blocking is false executes the scheduled events due to expire soonest (if any) and then return the deadline of the next scheduled call in the scheduler (if any). Either action or delayfunc can raise an exception. In either case, the scheduler will maintain a consistent state and propagate the exception. If an exception is raised by action, the event will not be attempted in future calls to run(). If a sequence of events takes longer to run than the time available before the next event, the scheduler will simply fall behind. No events will be dropped; the calling code is responsible for canceling events which are no longer pertinent.  Changed in version 3.3: blocking parameter was added.
secrets.choice(sequence)  
Return a randomly-chosen element from a non-empty sequence.
secrets.compare_digest(a, b)  
Return True if strings a and b are equal, otherwise False, in such a way as to reduce the risk of timing attacks. See hmac.compare_digest() for additional details.
secrets.randbelow(n)  
Return a random int in the range [0, n).
class secrets.SystemRandom  
A class for generating random numbers using the highest-quality sources provided by the operating system. See random.SystemRandom for additional details.
secrets.token_bytes([nbytes=None])  
Return a random byte string containing nbytes number of bytes. If nbytes is None or not supplied, a reasonable default is used. >>> token_bytes(16)  
b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'
secrets.token_hex([nbytes=None])  
Return a random text string, in hexadecimal. The string has nbytes random bytes, each byte converted to two hex digits. If nbytes is None or not supplied, a reasonable default is used. >>> token_hex(16)  
'f9bf78b9a18ce6d46a0cd2b0b86df9da'
secrets.token_urlsafe([nbytes=None])  
Return a random URL-safe text string, containing nbytes random bytes. The text is Base64 encoded, so on average each byte results in approximately 1.3 characters. If nbytes is None or not supplied, a reasonable default is used. >>> token_urlsafe(16)  
'Drmhze6EPcv0fN_81Bj-nA'
select.devpoll()  
(Only supported on Solaris and derivatives.) Returns a /dev/poll polling object; see section /dev/poll Polling Objects below for the methods supported by devpoll objects. devpoll() objects are linked to the number of file descriptors allowed at the time of instantiation. If your program reduces this value, devpoll() will fail. If your program increases this value, devpoll() may return an incomplete list of active file descriptors. The new file descriptor is non-inheritable.  New in version 3.3.   Changed in version 3.4: The new file descriptor is now non-inheritable.
devpoll.close()  
Close the file descriptor of the polling object.  New in version 3.4.
devpoll.closed  
True if the polling object is closed.  New in version 3.4.
devpoll.fileno()  
Return the file descriptor number of the polling object.  New in version 3.4.
devpoll.modify(fd[, eventmask])  
This method does an unregister() followed by a register(). It is (a bit) more efficient that doing the same explicitly.
devpoll.poll([timeout])  
Polls the set of registered file descriptors, and returns a possibly-empty list containing (fd, event) 2-tuples for the descriptors that have events or errors to report. fd is the file descriptor, and event is a bitmask with bits set for the reported events for that descriptor — POLLIN for waiting input, POLLOUT to indicate that the descriptor can be written to, and so forth. An empty list indicates that the call timed out and no file descriptors had any events to report. If timeout is given, it specifies the length of time in milliseconds which the system will wait for events before returning. If timeout is omitted, -1, or None, the call will block until there is an event for this poll object.  Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.
devpoll.register(fd[, eventmask])  
Register a file descriptor with the polling object. Future calls to the poll() method will then check whether the file descriptor has any pending I/O events. fd can be either an integer, or an object with a fileno() method that returns an integer. File objects implement fileno(), so they can also be used as the argument. eventmask is an optional bitmask describing the type of events you want to check for. The constants are the same that with poll() object. The default value is a combination of the constants POLLIN, POLLPRI, and POLLOUT.  Warning Registering a file descriptor that’s already registered is not an error, but the result is undefined. The appropriate action is to unregister or modify it first. This is an important difference compared with poll().
devpoll.unregister(fd)  
Remove a file descriptor being tracked by a polling object. Just like the register() method, fd can be an integer or an object with a fileno() method that returns an integer. Attempting to remove a file descriptor that was never registered is safely ignored.
select.epoll(sizehint=-1, flags=0)  
(Only supported on Linux 2.5.44 and newer.) Return an edge polling object, which can be used as Edge or Level Triggered interface for I/O events. sizehint informs epoll about the expected number of events to be registered. It must be positive, or -1 to use the default. It is only used on older systems where epoll_create1() is not available; otherwise it has no effect (though its value is still checked). flags is deprecated and completely ignored. However, when supplied, its value must be 0 or select.EPOLL_CLOEXEC, otherwise OSError is raised. See the Edge and Level Trigger Polling (epoll) Objects section below for the methods supported by epolling objects. epoll objects support the context management protocol: when used in a with statement, the new file descriptor is automatically closed at the end of the block. The new file descriptor is non-inheritable.  Changed in version 3.3: Added the flags parameter.   Changed in version 3.4: Support for the with statement was added. The new file descriptor is now non-inheritable.   Deprecated since version 3.4: The flags parameter. select.EPOLL_CLOEXEC is used by default now. Use os.set_inheritable() to make the file descriptor inheritable.
epoll.fromfd(fd)  
Create an epoll object from a given file descriptor.
epoll.poll(timeout=None, maxevents=-1)  
Wait for events. timeout in seconds (float)  Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.
epoll.register(fd[, eventmask])  
Register a fd descriptor with the epoll object.
epoll.unregister(fd)  
Remove a registered file descriptor from the epoll object.  Changed in version 3.9: The method no longer ignores the EBADF error.
exception select.error  
A deprecated alias of OSError.  Changed in version 3.3: Following PEP 3151, this class was made an alias of OSError.
select.kevent(ident, filter=KQ_FILTER_READ, flags=KQ_EV_ADD, fflags=0, data=0, udata=0)  
(Only supported on BSD.) Returns a kernel event object; see section Kevent Objects below for the methods supported by kevent objects.
kevent.fflags  
Filter specific flags. KQ_FILTER_READ and KQ_FILTER_WRITE filter flags:   
Constant Meaning   
KQ_NOTE_LOWAT low water mark of a socket buffer   KQ_FILTER_VNODE filter flags:   
Constant Meaning   
KQ_NOTE_DELETE unlink() was called  
KQ_NOTE_WRITE a write occurred  
KQ_NOTE_EXTEND the file was extended  
KQ_NOTE_ATTRIB an attribute was changed  
KQ_NOTE_LINK the link count has changed  
KQ_NOTE_RENAME the file was renamed  
KQ_NOTE_REVOKE access to the file was revoked   KQ_FILTER_PROC filter flags:   
Constant Meaning   
KQ_NOTE_EXIT the process has exited  
KQ_NOTE_FORK the process has called fork()  
KQ_NOTE_EXEC the process has executed a new process  
KQ_NOTE_PCTRLMASK internal filter flag  
KQ_NOTE_PDATAMASK internal filter flag  
KQ_NOTE_TRACK follow a process across fork()  
KQ_NOTE_CHILD returned on the child process for NOTE_TRACK  
KQ_NOTE_TRACKERR unable to attach to a child   KQ_FILTER_NETDEV filter flags (not available on Mac OS X):   
Constant Meaning   
KQ_NOTE_LINKUP link is up  
KQ_NOTE_LINKDOWN link is down  
KQ_NOTE_LINKINV link state is invalid
kevent.filter  
Name of the kernel filter.   
Constant Meaning   
KQ_FILTER_READ Takes a descriptor and returns whenever there is data available to read  
KQ_FILTER_WRITE Takes a descriptor and returns whenever there is data available to write  
KQ_FILTER_AIO AIO requests  
KQ_FILTER_VNODE Returns when one or more of the requested events watched in fflag occurs  
KQ_FILTER_PROC Watch for events on a process id  
KQ_FILTER_NETDEV Watch for events on a network device [not available on Mac OS X]  
KQ_FILTER_SIGNAL Returns whenever the watched signal is delivered to the process  
KQ_FILTER_TIMER Establishes an arbitrary timer
kevent.flags  
Filter action.   
Constant Meaning   
KQ_EV_ADD Adds or modifies an event  
KQ_EV_DELETE Removes an event from the queue  
KQ_EV_ENABLE Permitscontrol() to returns the event  
KQ_EV_DISABLE Disablesevent  
KQ_EV_ONESHOT Removes event after first occurrence  
KQ_EV_CLEAR Reset the state after an event is retrieved  
KQ_EV_SYSFLAGS internal event  
KQ_EV_FLAG1 internal event  
KQ_EV_EOF Filter specific EOF condition  
KQ_EV_ERROR See return values
kevent.ident  
Value used to identify the event. The interpretation depends on the filter but it’s usually the file descriptor. In the constructor ident can either be an int or an object with a fileno() method. kevent stores the integer internally.
select.kqueue()  
(Only supported on BSD.) Returns a kernel queue object; see section Kqueue Objects below for the methods supported by kqueue objects. The new file descriptor is non-inheritable.  Changed in version 3.4: The new file descriptor is now non-inheritable.
kqueue.control(changelist, max_events[, timeout]) → eventlist  
Low level interface to kevent  changelist must be an iterable of kevent objects or None
 max_events must be 0 or a positive integer timeout in seconds (floats possible); the default is None, to wait forever   Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.
kqueue.fromfd(fd)  
Create a kqueue object from a given file descriptor.
select.PIPE_BUF  
The minimum number of bytes which can be written without blocking to a pipe when the pipe has been reported as ready for writing by select(), poll() or another interface in this module. This doesn’t apply to other kind of file-like objects such as sockets. This value is guaranteed by POSIX to be at least 512. Availability: Unix  New in version 3.2.
select.poll()  
(Not supported by all operating systems.) Returns a polling object, which supports registering and unregistering file descriptors, and then polling them for I/O events; see section Polling Objects below for the methods supported by polling objects.
poll.modify(fd, eventmask)  
Modifies an already registered fd. This has the same effect as register(fd, eventmask). Attempting to modify a file descriptor that was never registered causes an OSError exception with errno ENOENT to be raised.
poll.poll([timeout])  
Polls the set of registered file descriptors, and returns a possibly-empty list containing (fd, event) 2-tuples for the descriptors that have events or errors to report. fd is the file descriptor, and event is a bitmask with bits set for the reported events for that descriptor — POLLIN for waiting input, POLLOUT to indicate that the descriptor can be written to, and so forth. An empty list indicates that the call timed out and no file descriptors had any events to report. If timeout is given, it specifies the length of time in milliseconds which the system will wait for events before returning. If timeout is omitted, negative, or None, the call will block until there is an event for this poll object.  Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.
poll.register(fd[, eventmask])  
Register a file descriptor with the polling object. Future calls to the poll() method will then check whether the file descriptor has any pending I/O events. fd can be either an integer, or an object with a fileno() method that returns an integer. File objects implement fileno(), so they can also be used as the argument. eventmask is an optional bitmask describing the type of events you want to check for, and can be a combination of the constants POLLIN, POLLPRI, and POLLOUT, described in the table below. If not specified, the default value used will check for all 3 types of events.   
Constant Meaning   
POLLIN There is data to read  
POLLPRI There is urgent data to read  
POLLOUT Ready for output: writing will not block  
POLLERR Error condition of some sort  
POLLHUP Hung up  
POLLRDHUP Stream socket peer closed connection, or shut down writing half of connection  
POLLNVAL Invalid request: descriptor not open   Registering a file descriptor that’s already registered is not an error, and has the same effect as registering the descriptor exactly once.
poll.unregister(fd)  
Remove a file descriptor being tracked by a polling object. Just like the register() method, fd can be an integer or an object with a fileno() method that returns an integer. Attempting to remove a file descriptor that was never registered causes a KeyError exception to be raised.
select.select(rlist, wlist, xlist[, timeout])  
This is a straightforward interface to the Unix select() system call. The first three arguments are iterables of ‘waitable objects’: either integers representing file descriptors or objects with a parameterless method named fileno() returning such an integer:  
rlist: wait until ready for reading 
wlist: wait until ready for writing 
xlist: wait for an “exceptional condition” (see the manual page for what your system considers such a condition)  Empty iterables are allowed, but acceptance of three empty iterables is platform-dependent. (It is known to work on Unix but not on Windows.) The optional timeout argument specifies a time-out as a floating point number in seconds. When the timeout argument is omitted the function blocks until at least one file descriptor is ready. A time-out value of zero specifies a poll and never blocks. The return value is a triple of lists of objects that are ready: subsets of the first three arguments. When the time-out is reached without a file descriptor becoming ready, three empty lists are returned. Among the acceptable object types in the iterables are Python file objects (e.g. sys.stdin, or objects returned by open() or os.popen()), socket objects returned by socket.socket(). You may also define a wrapper class yourself, as long as it has an appropriate fileno() method (that really returns a file descriptor, not just a random integer).  Note File objects on Windows are not acceptable, but sockets are. On Windows, the underlying select() function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock.   Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.
close()  
Close the selector. This must be called to make sure that any underlying resource is freed. The selector shall not be used once it has been closed.