neulab/docprompting-conala huggingface dataset:
_anonymous_  
An optional sequence that lists the names of unnamed (anonymous) fields. _anonymous_ must be already defined when _fields_ is assigned, otherwise it will have no effect. The fields listed in this variable must be structure or union type fields. ctypes will create descriptors in the structure type that allows accessing the nested fields directly, without the need to create the structure or union field. Here is an example type (Windows): class _U(Union):
    _fields_ = [("lptdesc", POINTER(TYPEDESC)),
                ("lpadesc", POINTER(ARRAYDESC)),
                ("hreftype", HREFTYPE)]

class TYPEDESC(Structure):
    _anonymous_ = ("u",)
    _fields_ = [("u", _U),
                ("vt", VARTYPE)]
 The TYPEDESC structure describes a COM data type, the vt field specifies which one of the union fields is valid. Since the u field is defined as anonymous field, it is now possible to access the members directly off the TYPEDESC instance. td.lptdesc and td.u.lptdesc are equivalent, but the former is faster since it does not need to create a temporary union instance: td = TYPEDESC()
td.vt = VT_PTR
td.lptdesc = POINTER(some_type)
td.u.lptdesc = POINTER(some_type)
_fields_  
A sequence defining the structure fields. The items must be 2-tuples or 3-tuples. The first item is the name of the field, the second item specifies the type of the field; it can be any ctypes data type. For integer type fields like c_int, a third optional item can be given. It must be a small positive integer defining the bit width of the field. Field names must be unique within one structure or union. This is not checked, only one field can be accessed when names are repeated. It is possible to define the _fields_ class variable after the class statement that defines the Structure subclass, this allows creating data types that directly or indirectly reference themselves: class List(Structure):
    pass
List._fields_ = [("pnext", POINTER(List)),
                 ...
                ]
 The _fields_ class variable must, however, be defined before the type is first used (an instance is created, sizeof() is called on it, and so on). Later assignments to the _fields_ class variable will raise an AttributeError. It is possible to define sub-subclasses of structure types, they inherit the fields of the base class plus the _fields_ defined in the sub-subclass, if any.
_pack_  
An optional small integer that allows overriding the alignment of structure fields in the instance. _pack_ must already be defined when _fields_ is assigned, otherwise it will have no effect.
class ctypes.Union(*args, **kw)  
Abstract base class for unions in native byte order.
ctypes.util.find_library(name)  
Try to find a library and return a pathname. name is the library name without any prefix like lib, suffix like .so, .dylib or version number (this is the form used for the posix linker option -l). If no library can be found, returns None. The exact functionality is system dependent.
ctypes.util.find_msvcrt()  
Windows only: return the filename of the VC runtime library used by Python, and by the extension modules. If the name of the library cannot be determined, None is returned. If you need to free memory, for example, allocated by an extension module with a call to the free(void *), it is important that you use the function in the same library that allocated the memory.
class ctypes.WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)  
Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the stdcall calling convention, and are assumed to return int by default. On Windows CE only the standard calling convention is used, for convenience the WinDLL and OleDLL use the standard calling convention on this platform.
ctypes.WinError(code=None, descr=None)  
Windows only: this function is probably the worst-named thing in ctypes. It creates an instance of OSError. If code is not specified, GetLastError is called to determine the error code. If descr is not specified, FormatError() is called to get a textual description of the error.  Changed in version 3.3: An instance of WindowsError used to be created.
ctypes.WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)  
Windows only: The returned function prototype creates functions that use the stdcall calling convention, except on Windows CE where WINFUNCTYPE() is the same as CFUNCTYPE(). The function will release the GIL during the call. use_errno and use_last_error have the same meaning as above.
ctypes.wstring_at(address, size=-1)  
This function returns the wide character string starting at memory address address as a string. If size is specified, it is used as the number of characters of the string, otherwise the string is assumed to be zero-terminated. Raises an auditing event ctypes.wstring_at with arguments address, size.
class ctypes._CData  
This non-public class is the common base class of all ctypes data types. Among other things, all ctypes type instances contain a memory block that hold C compatible data; the address of the memory block is returned by the addressof() helper function. Another instance variable is exposed as _objects; this contains other Python objects that need to be kept alive in case the memory block contains pointers. Common methods of ctypes data types, these are all class methods (to be exact, they are methods of the metaclass):  
from_buffer(source[, offset])  
This method returns a ctypes instance that shares the buffer of the source object. The source object must support the writeable buffer interface. The optional offset parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a ValueError is raised. Raises an auditing event ctypes.cdata/buffer with arguments pointer, size, offset. 
  
from_buffer_copy(source[, offset])  
This method creates a ctypes instance, copying the buffer from the source object buffer which must be readable. The optional offset parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a ValueError is raised. Raises an auditing event ctypes.cdata/buffer with arguments pointer, size, offset. 
  
from_address(address)  
This method returns a ctypes type instance using the memory specified by address which must be an integer.
This method, and others that indirectly call this method, raises an auditing event ctypes.cdata with argument address. 
  
from_param(obj)  
This method adapts obj to a ctypes type. It is called with the actual object used in a foreign function call when the type is present in the foreign function’s argtypes tuple; it must return an object that can be used as a function call parameter. All ctypes data types have a default implementation of this classmethod that normally returns obj if that is an instance of the type. Some types accept other objects as well. 
  
in_dll(library, name)  
This method returns a ctypes type instance exported by a shared library. name is the name of the symbol that exports the data, library is the loaded shared library. 
 Common instance variables of ctypes data types:  
_b_base_  
Sometimes ctypes data instances do not own the memory block they contain, instead they share part of the memory block of a base object. The _b_base_ read-only member is the root ctypes object that owns the memory block. 
  
_b_needsfree_  
This read-only variable is true when the ctypes data instance has allocated the memory block itself, false otherwise. 
  
_objects  
This member is either None or a dictionary containing Python objects that need to be kept alive so that the memory block contents is kept valid. This object is only exposed for debugging; never modify the contents of this dictionary.
from_address(address)  
This method returns a ctypes type instance using the memory specified by address which must be an integer.
This method, and others that indirectly call this method, raises an auditing event ctypes.cdata with argument address.
from_buffer(source[, offset])  
This method returns a ctypes instance that shares the buffer of the source object. The source object must support the writeable buffer interface. The optional offset parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a ValueError is raised. Raises an auditing event ctypes.cdata/buffer with arguments pointer, size, offset.
from_buffer_copy(source[, offset])  
This method creates a ctypes instance, copying the buffer from the source object buffer which must be readable. The optional offset parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a ValueError is raised. Raises an auditing event ctypes.cdata/buffer with arguments pointer, size, offset.
from_param(obj)  
This method adapts obj to a ctypes type. It is called with the actual object used in a foreign function call when the type is present in the foreign function’s argtypes tuple; it must return an object that can be used as a function call parameter. All ctypes data types have a default implementation of this classmethod that normally returns obj if that is an instance of the type. Some types accept other objects as well.
in_dll(library, name)  
This method returns a ctypes type instance exported by a shared library. name is the name of the symbol that exports the data, library is the loaded shared library.
_b_base_  
Sometimes ctypes data instances do not own the memory block they contain, instead they share part of the memory block of a base object. The _b_base_ read-only member is the root ctypes object that owns the memory block.
_b_needsfree_  
This read-only variable is true when the ctypes data instance has allocated the memory block itself, false otherwise.
_objects  
This member is either None or a dictionary containing Python objects that need to be kept alive so that the memory block contents is kept valid. This object is only exposed for debugging; never modify the contents of this dictionary.
class ctypes._FuncPtr  
Base class for C callable foreign functions. Instances of foreign functions are also C compatible data types; they represent C function pointers. This behavior can be customized by assigning to special attributes of the foreign function object.  
restype  
Assign a ctypes type to specify the result type of the foreign function. Use None for void, a function not returning anything. It is possible to assign a callable Python object that is not a ctypes type, in this case the function is assumed to return a C int, and the callable will be called with this integer, allowing further processing or error checking. Using this is deprecated, for more flexible post processing or error checking use a ctypes data type as restype and assign a callable to the errcheck attribute. 
  
argtypes  
Assign a tuple of ctypes types to specify the argument types that the function accepts. Functions using the stdcall calling convention can only be called with the same number of arguments as the length of this tuple; functions using the C calling convention accept additional, unspecified arguments as well. When a foreign function is called, each actual argument is passed to the from_param() class method of the items in the argtypes tuple, this method allows adapting the actual argument to an object that the foreign function accepts. For example, a c_char_p item in the argtypes tuple will convert a string passed as argument into a bytes object using ctypes conversion rules. New: It is now possible to put items in argtypes which are not ctypes types, but each item must have a from_param() method which returns a value usable as argument (integer, string, ctypes instance). This allows defining adapters that can adapt custom objects as function parameters. 
  
errcheck  
Assign a Python function or another callable to this attribute. The callable will be called with three or more arguments:  
callable(result, func, arguments)  
result is what the foreign function returns, as specified by the restype attribute. func is the foreign function object itself, this allows reusing the same callable object to check or post process the results of several functions. arguments is a tuple containing the parameters originally passed to the function call, this allows specializing the behavior on the arguments used. 
 The object that this function returns will be returned from the foreign function call, but it can also check the result value and raise an exception if the foreign function call failed.
argtypes  
Assign a tuple of ctypes types to specify the argument types that the function accepts. Functions using the stdcall calling convention can only be called with the same number of arguments as the length of this tuple; functions using the C calling convention accept additional, unspecified arguments as well. When a foreign function is called, each actual argument is passed to the from_param() class method of the items in the argtypes tuple, this method allows adapting the actual argument to an object that the foreign function accepts. For example, a c_char_p item in the argtypes tuple will convert a string passed as argument into a bytes object using ctypes conversion rules. New: It is now possible to put items in argtypes which are not ctypes types, but each item must have a from_param() method which returns a value usable as argument (integer, string, ctypes instance). This allows defining adapters that can adapt custom objects as function parameters.
errcheck  
Assign a Python function or another callable to this attribute. The callable will be called with three or more arguments:  
callable(result, func, arguments)  
result is what the foreign function returns, as specified by the restype attribute. func is the foreign function object itself, this allows reusing the same callable object to check or post process the results of several functions. arguments is a tuple containing the parameters originally passed to the function call, this allows specializing the behavior on the arguments used. 
 The object that this function returns will be returned from the foreign function call, but it can also check the result value and raise an exception if the foreign function call failed.
restype  
Assign a ctypes type to specify the result type of the foreign function. Use None for void, a function not returning anything. It is possible to assign a callable Python object that is not a ctypes type, in this case the function is assumed to return a C int, and the callable will be called with this integer, allowing further processing or error checking. Using this is deprecated, for more flexible post processing or error checking use a ctypes data type as restype and assign a callable to the errcheck attribute.
class ctypes._Pointer  
Private, abstract base class for pointers. Concrete pointer types are created by calling POINTER() with the type that will be pointed to; this is done automatically by pointer(). If a pointer points to an array, its elements can be read and written using standard subscript and slice accesses. Pointer objects have no size, so len() will raise TypeError. Negative subscripts will read from the memory before the pointer (as in C), and out-of-range subscripts will probably crash with an access violation (if you’re lucky).  
_type_  
Specifies the type pointed to. 
  
contents  
Returns the object to which to pointer points. Assigning to this attribute changes the pointer to point to the assigned object.
contents  
Returns the object to which to pointer points. Assigning to this attribute changes the pointer to point to the assigned object.
class ctypes._SimpleCData  
This non-public class is the base class of all fundamental ctypes data types. It is mentioned here because it contains the common attributes of the fundamental ctypes data types. _SimpleCData is a subclass of _CData, so it inherits their methods and attributes. ctypes data types that are not and do not contain pointers can now be pickled. Instances have a single attribute:  
value  
This attribute contains the actual value of the instance. For integer and pointer types, it is an integer, for character types, it is a single character bytes object or string, for character pointer types it is a Python bytes object or string. When the value attribute is retrieved from a ctypes instance, usually a new object is returned each time. ctypes does not implement original object return, always a new object is constructed. The same is true for all other ctypes object instances.
value  
This attribute contains the actual value of the instance. For integer and pointer types, it is an integer, for character types, it is a single character bytes object or string, for character pointer types it is a Python bytes object or string. When the value attribute is retrieved from a ctypes instance, usually a new object is returned each time. ctypes does not implement original object return, always a new object is constructed. The same is true for all other ctypes object instances.
curses.ascii.alt(c)  
Return the 8-bit character corresponding to the given ASCII character (the character bit value is bitwise-ored with 0x80).
curses.ascii.ascii(c)  
Return the ASCII value corresponding to the low 7 bits of c.
curses.ascii.controlnames  
A 33-element string array that contains the ASCII mnemonics for the thirty-two ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the mnemonic SP for the space character.
curses.ascii.ctrl(c)  
Return the control character corresponding to the given character (the character bit value is bitwise-anded with 0x1f).
curses.ascii.isalnum(c)  
Checks for an ASCII alphanumeric character; it is equivalent to isalpha(c) or
isdigit(c).
curses.ascii.isalpha(c)  
Checks for an ASCII alphabetic character; it is equivalent to isupper(c) or
islower(c).
curses.ascii.isascii(c)  
Checks for a character value that fits in the 7-bit ASCII set.
curses.ascii.isblank(c)  
Checks for an ASCII whitespace character; space or horizontal tab.
curses.ascii.iscntrl(c)  
Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f).
curses.ascii.isctrl(c)  
Checks for an ASCII control character (ordinal values 0 to 31).
curses.ascii.isdigit(c)  
Checks for an ASCII decimal digit, '0' through '9'. This is equivalent to c in string.digits.
curses.ascii.isgraph(c)  
Checks for ASCII any printable character except space.
curses.ascii.islower(c)  
Checks for an ASCII lower-case character.
curses.ascii.ismeta(c)  
Checks for a non-ASCII character (ordinal values 0x80 and above).
curses.ascii.isprint(c)  
Checks for any ASCII printable character including space.
curses.ascii.ispunct(c)  
Checks for any printable ASCII character which is not a space or an alphanumeric character.
curses.ascii.isspace(c)  
Checks for ASCII white-space characters; space, line feed, carriage return, form feed, horizontal tab, vertical tab.
curses.ascii.isupper(c)  
Checks for an ASCII uppercase letter.
curses.ascii.isxdigit(c)  
Checks for an ASCII hexadecimal digit. This is equivalent to c in
string.hexdigits.
curses.ascii.unctrl(c)  
Return a string representation of the ASCII character c. If c is printable, this string is the character itself. If the character is a control character (0x00–0x1f) the string consists of a caret ('^') followed by the corresponding uppercase letter. If the character is an ASCII delete (0x7f) the string is '^?'. If the character has its meta bit (0x80) set, the meta bit is stripped, the preceding rules applied, and '!' prepended to the result.
curses.baudrate()  
Return the output speed of the terminal in bits per second. On software terminal emulators it will have a fixed high value. Included for historical reasons; in former times, it was used to write output loops for time delays and occasionally to change interfaces depending on the line speed.
curses.can_change_color()  
Return True or False, depending on whether the programmer can change the colors displayed by the terminal.
curses.cbreak()  
Enter cbreak mode. In cbreak mode (sometimes called “rare” mode) normal tty line buffering is turned off and characters are available to be read one by one. However, unlike raw mode, special characters (interrupt, quit, suspend, and flow control) retain their effects on the tty driver and calling program. Calling first raw() then cbreak() leaves the terminal in cbreak mode.
curses.color_content(color_number)  
Return the intensity of the red, green, and blue (RGB) components in the color color_number, which must be between 0 and COLORS - 1. Return a 3-tuple, containing the R,G,B values for the given color, which will be between 0 (no component) and 1000 (maximum amount of component).
curses.color_pair(pair_number)  
Return the attribute value for displaying text in the specified color pair. Only the first 256 color pairs are supported. This attribute value can be combined with A_STANDOUT, A_REVERSE, and the other A_* attributes. pair_number() is the counterpart to this function.
curses.curs_set(visibility)  
Set the cursor state. visibility can be set to 0, 1, or 2, for invisible, normal, or very visible. If the terminal supports the visibility requested, return the previous cursor state; otherwise raise an exception. On many terminals, the “visible” mode is an underline cursor and the “very visible” mode is a block cursor.
curses.def_prog_mode()  
Save the current terminal mode as the “program” mode, the mode when the running program is using curses. (Its counterpart is the “shell” mode, for when the program is not in curses.) Subsequent calls to reset_prog_mode() will restore this mode.
curses.def_shell_mode()  
Save the current terminal mode as the “shell” mode, the mode when the running program is not using curses. (Its counterpart is the “program” mode, when the program is using curses capabilities.) Subsequent calls to reset_shell_mode() will restore this mode.
curses.delay_output(ms)  
Insert an ms millisecond pause in output.
curses.doupdate()  
Update the physical screen. The curses library keeps two data structures, one representing the current physical screen contents and a virtual screen representing the desired next state. The doupdate() ground updates the physical screen to match the virtual screen. The virtual screen may be updated by a noutrefresh() call after write operations such as addstr() have been performed on a window. The normal refresh() call is simply noutrefresh() followed by doupdate(); if you have to update multiple windows, you can speed performance and perhaps reduce screen flicker by issuing noutrefresh() calls on all windows, followed by a single doupdate().
curses.echo()  
Enter echo mode. In echo mode, each character input is echoed to the screen as it is entered.
curses.endwin()  
De-initialize the library, and return terminal to normal status.
curses.erasechar()  
Return the user’s current erase character as a one-byte bytes object. Under Unix operating systems this is a property of the controlling tty of the curses program, and is not set by the curses library itself.
curses.ERR  
Some curses routines that return an integer, such as getch(), return ERR upon failure.
curses.filter()  
The filter() routine, if used, must be called before initscr() is called. The effect is that, during those calls, LINES is set to 1; the capabilities clear, cup, cud, cud1, cuu1, cuu, vpa are disabled; and the home string is set to the value of cr. The effect is that the cursor is confined to the current line, and so are screen updates. This may be used for enabling character-at-a-time line editing without touching the rest of the screen.
curses.flash()  
Flash the screen. That is, change it to reverse-video and then change it back in a short interval. Some people prefer such as ‘visible bell’ to the audible attention signal produced by beep().
curses.flushinp()  
Flush all input buffers. This throws away any typeahead that has been typed by the user and has not yet been processed by the program.