neulab/docprompting-conala huggingface dataset:
class wsgiref.simple_server.WSGIRequestHandler(request, client_address, server)  
Create an HTTP handler for the given request (i.e. a socket), client_address (a (host,port) tuple), and server (WSGIServer instance). You do not need to create instances of this class directly; they are automatically created as needed by WSGIServer objects. You can, however, subclass this class and supply it as a handler_class to the make_server() function. Some possibly relevant methods for overriding in subclasses:  
get_environ()  
Returns a dictionary containing the WSGI environment for a request. The default implementation copies the contents of the WSGIServer object’s base_environ dictionary attribute and then adds various headers derived from the HTTP request. Each call to this method should return a new dictionary containing all of the relevant CGI environment variables as specified in PEP 3333. 
  
get_stderr()  
Return the object that should be used as the wsgi.errors stream. The default implementation just returns sys.stderr. 
  
handle()  
Process the HTTP request. The default implementation creates a handler instance using a wsgiref.handlers class to implement the actual WSGI application interface.
get_environ()  
Returns a dictionary containing the WSGI environment for a request. The default implementation copies the contents of the WSGIServer object’s base_environ dictionary attribute and then adds various headers derived from the HTTP request. Each call to this method should return a new dictionary containing all of the relevant CGI environment variables as specified in PEP 3333.
get_stderr()  
Return the object that should be used as the wsgi.errors stream. The default implementation just returns sys.stderr.
handle()  
Process the HTTP request. The default implementation creates a handler instance using a wsgiref.handlers class to implement the actual WSGI application interface.
class wsgiref.simple_server.WSGIServer(server_address, RequestHandlerClass)  
Create a WSGIServer instance. server_address should be a (host,port) tuple, and RequestHandlerClass should be the subclass of http.server.BaseHTTPRequestHandler that will be used to process requests. You do not normally need to call this constructor, as the make_server() function can handle all the details for you. WSGIServer is a subclass of http.server.HTTPServer, so all of its methods (such as serve_forever() and handle_request()) are available. WSGIServer also provides these WSGI-specific methods:  
set_app(application)  
Sets the callable application as the WSGI application that will receive requests. 
  
get_app()  
Returns the currently-set application callable. 
 Normally, however, you do not need to use these additional methods, as set_app() is normally called by make_server(), and the get_app() exists mainly for the benefit of request handler instances.
set_app(application)  
Sets the callable application as the WSGI application that will receive requests.
wsgiref.util.application_uri(environ)  
Similar to request_uri(), except that the PATH_INFO and QUERY_STRING variables are ignored. The result is the base URI of the application object addressed by the request.
class wsgiref.util.FileWrapper(filelike, blksize=8192)  
A wrapper to convert a file-like object to an iterator. The resulting objects support both __getitem__() and __iter__() iteration styles, for compatibility with Python 2.1 and Jython. As the object is iterated over, the optional blksize parameter will be repeatedly passed to the filelike object’s read() method to obtain bytestrings to yield. When read() returns an empty bytestring, iteration is ended and is not resumable. If filelike has a close() method, the returned object will also have a close() method, and it will invoke the filelike object’s close() method when called. Example usage: from io import StringIO
from wsgiref.util import FileWrapper

# We're using a StringIO-buffer for as the file-like object
filelike = StringIO("This is an example file-like object"*10)
wrapper = FileWrapper(filelike, blksize=5)

for chunk in wrapper:
    print(chunk)
  Deprecated since version 3.8: Support for sequence protocol is deprecated.
wsgiref.util.guess_scheme(environ)  
Return a guess for whether wsgi.url_scheme should be “http” or “https”, by checking for a HTTPS environment variable in the environ dictionary. The return value is a string. This function is useful when creating a gateway that wraps CGI or a CGI-like protocol such as FastCGI. Typically, servers providing such protocols will include a HTTPS variable with a value of “1”, “yes”, or “on” when a request is received via SSL. So, this function returns “https” if such a value is found, and “http” otherwise.
wsgiref.util.is_hop_by_hop(header_name)  
Return True if ‘header_name’ is an HTTP/1.1 “Hop-by-Hop” header, as defined by RFC 2616.
wsgiref.util.request_uri(environ, include_query=True)  
Return the full request URI, optionally including the query string, using the algorithm found in the “URL Reconstruction” section of PEP 3333. If include_query is false, the query string is not included in the resulting URI.
wsgiref.util.setup_testing_defaults(environ)  
Update environ with trivial defaults for testing purposes. This routine adds various parameters required for WSGI, including HTTP_HOST, SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, and all of the PEP 3333-defined wsgi.* variables. It only supplies default values, and does not replace any existing settings for these variables. This routine is intended to make it easier for unit tests of WSGI servers and applications to set up dummy environments. It should NOT be used by actual WSGI servers or applications, since the data is fake! Example usage: from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server

# A relatively simple WSGI application. It's going to print out the
# environment dictionary after being updated by setup_testing_defaults
def simple_app(environ, start_response):
    setup_testing_defaults(environ)

    status = '200 OK'
    headers = [('Content-type', 'text/plain; charset=utf-8')]

    start_response(status, headers)

    ret = [("%s: %s\n" % (key, value)).encode("utf-8")
           for key, value in environ.items()]
    return ret

with make_server('', 8000, simple_app) as httpd:
    print("Serving on port 8000...")
    httpd.serve_forever()
wsgiref.util.shift_path_info(environ)  
Shift a single name from PATH_INFO to SCRIPT_NAME and return the name. The environ dictionary is modified in-place; use a copy if you need to keep the original PATH_INFO or SCRIPT_NAME intact. If there are no remaining path segments in PATH_INFO, None is returned. Typically, this routine is used to process each portion of a request URI path, for example to treat the path as a series of dictionary keys. This routine modifies the passed-in environment to make it suitable for invoking another WSGI application that is located at the target URI. For example, if there is a WSGI application at /foo, and the request URI path is /foo/bar/baz, and the WSGI application at /foo calls shift_path_info(), it will receive the string “bar”, and the environment will be updated to be suitable for passing to a WSGI application at /foo/bar. That is, SCRIPT_NAME will change from /foo to /foo/bar, and PATH_INFO will change from /bar/baz to /baz. When PATH_INFO is just a “/”, this routine returns an empty string and appends a trailing slash to SCRIPT_NAME, even though empty path segments are normally ignored, and SCRIPT_NAME doesn’t normally end in a slash. This is intentional behavior, to ensure that an application can tell the difference between URIs ending in /x from ones ending in /x/ when using this routine to do object traversal.
wsgiref.validate.validator(application)  
Wrap application and return a new WSGI application object. The returned application will forward all requests to the original application, and will check that both the application and the server invoking it are conforming to the WSGI specification and to RFC 2616. Any detected nonconformance results in an AssertionError being raised; note, however, that how these errors are handled is server-dependent. For example, wsgiref.simple_server and other servers based on wsgiref.handlers (that don’t override the error handling methods to do something else) will simply output a message that an error has occurred, and dump the traceback to sys.stderr or some other error stream. This wrapper may also generate output using the warnings module to indicate behaviors that are questionable but which may not actually be prohibited by PEP 3333. Unless they are suppressed using Python command-line options or the warnings API, any such warnings will be written to sys.stderr (not wsgi.errors, unless they happen to be the same object). Example usage: from wsgiref.validate import validator
from wsgiref.simple_server import make_server

# Our callable object which is intentionally not compliant to the
# standard, so the validator is going to break
def simple_app(environ, start_response):
    status = '200 OK'  # HTTP Status
    headers = [('Content-type', 'text/plain')]  # HTTP Headers
    start_response(status, headers)

    # This is going to break because we need to return a list, and
    # the validator is going to inform us
    return b"Hello World"

# This is the application wrapped in a validator
validator_app = validator(simple_app)

with make_server('', 8000, validator_app) as httpd:
    print("Listening on port 8000....")
    httpd.serve_forever()
exception xdrlib.ConversionError  
Class derived from Error. Contains no additional instance variables.
exception xdrlib.Error  
The base exception class. Error has a single public attribute msg containing the description of the error.
class xdrlib.Packer  
Packer is the class for packing data into XDR representation. The Packer class is instantiated with no arguments.
Packer.pack_array(list, pack_item)  
Packs a variable length list of homogeneous items. First, the length of the list is packed as an unsigned integer, then each element is packed as in pack_farray() above.
Packer.pack_bytes(bytes)  
Packs a variable length byte stream, similarly to pack_string().
Packer.pack_double(value)  
Packs the double-precision floating point number value.
Packer.pack_farray(n, array, pack_item)  
Packs a fixed length list (array) of homogeneous items. n is the length of the list; it is not packed into the buffer, but a ValueError exception is raised if len(array) is not equal to n. As above, pack_item is the function used to pack each element.
Packer.pack_float(value)  
Packs the single-precision floating point number value.
Packer.pack_fopaque(n, data)  
Packs a fixed length opaque data stream, similarly to pack_fstring().
Packer.pack_fstring(n, s)  
Packs a fixed length string, s. n is the length of the string but it is not packed into the data buffer. The string is padded with null bytes if necessary to guaranteed 4 byte alignment.
Packer.pack_list(list, pack_item)  
Packs a list of homogeneous items. This method is useful for lists with an indeterminate size; i.e. the size is not available until the entire list has been walked. For each item in the list, an unsigned integer 1 is packed first, followed by the data value from the list. pack_item is the function that is called to pack the individual item. At the end of the list, an unsigned integer 0 is packed. For example, to pack a list of integers, the code might appear like this: import xdrlib
p = xdrlib.Packer()
p.pack_list([1, 2, 3], p.pack_int)
Packer.pack_opaque(data)  
Packs a variable length opaque data string, similarly to pack_string().
Packer.pack_string(s)  
Packs a variable length string, s. The length of the string is first packed as an unsigned integer, then the string data is packed with pack_fstring().
class xdrlib.Unpacker(data)  
Unpacker is the complementary class which unpacks XDR data values from a string buffer. The input buffer is given as data.
Unpacker.done()  
Indicates unpack completion. Raises an Error exception if all of the data has not been unpacked.
Unpacker.get_buffer()  
Returns the current unpack data buffer as a string.
Unpacker.get_position()  
Returns the current unpack position in the data buffer.
Unpacker.reset(data)  
Resets the string buffer with the given data.
Unpacker.set_position(position)  
Sets the data buffer unpack position to position. You should be careful about using get_position() and set_position().
Unpacker.unpack_array(unpack_item)  
Unpacks and returns a variable length list of homogeneous items. First, the length of the list is unpacked as an unsigned integer, then each element is unpacked as in unpack_farray() above.
Unpacker.unpack_bytes()  
Unpacks and returns a variable length byte stream, similarly to unpack_string().
Unpacker.unpack_double()  
Unpacks a double-precision floating point number, similarly to unpack_float().
Unpacker.unpack_farray(n, unpack_item)  
Unpacks and returns (as a list) a fixed length array of homogeneous items. n is number of list elements to expect in the buffer. As above, unpack_item is the function used to unpack each element.
Unpacker.unpack_float()  
Unpacks a single-precision floating point number.
Unpacker.unpack_fopaque(n)  
Unpacks and returns a fixed length opaque data stream, similarly to unpack_fstring().
Unpacker.unpack_fstring(n)  
Unpacks and returns a fixed length string. n is the number of characters expected. Padding with null bytes to guaranteed 4 byte alignment is assumed.
Unpacker.unpack_list(unpack_item)  
Unpacks and returns a list of homogeneous items. The list is unpacked one element at a time by first unpacking an unsigned integer flag. If the flag is 1, then the item is unpacked and appended to the list. A flag of 0 indicates the end of the list. unpack_item is the function that is called to unpack the items.
Unpacker.unpack_opaque()  
Unpacks and returns a variable length opaque data string, similarly to unpack_string().
Unpacker.unpack_string()  
Unpacks and returns a variable length string. The length of the string is first unpacked as an unsigned integer, then the string data is unpacked with unpack_fstring().
Attr.localName  
The part of the name following the colon if there is one, else the entire name. This is a read-only attribute.
Attr.name  
The attribute name. In a namespace-using document it may include a colon.
Attr.prefix  
The part of the name preceding the colon if there is one, else the empty string.
Attr.value  
The text value of the attribute. This is a synonym for the nodeValue attribute.
Comment.data  
The content of the comment as a string. The attribute contains all characters between the leading <!-- and trailing -->, but does not include them.
Document.createAttribute(name)  
Create and return an attribute node. This method does not associate the attribute node with any particular element. You must use setAttributeNode() on the appropriate Element object to use the newly created attribute instance.
Document.createAttributeNS(namespaceURI, qualifiedName)  
Create and return an attribute node with a namespace. The tagName may have a prefix. This method does not associate the attribute node with any particular element. You must use setAttributeNode() on the appropriate Element object to use the newly created attribute instance.
Document.createComment(data)  
Create and return a comment node containing the data passed as a parameter. As with the other creation methods, this one does not insert the node into the tree.
Document.createElement(tagName)  
Create and return a new element node. The element is not inserted into the document when it is created. You need to explicitly insert it with one of the other methods such as insertBefore() or appendChild().
Document.createElementNS(namespaceURI, tagName)  
Create and return a new element with a namespace. The tagName may have a prefix. The element is not inserted into the document when it is created. You need to explicitly insert it with one of the other methods such as insertBefore() or appendChild().
Document.createProcessingInstruction(target, data)  
Create and return a processing instruction node containing the target and data passed as parameters. As with the other creation methods, this one does not insert the node into the tree.
Document.createTextNode(data)  
Create and return a text node containing the data passed as a parameter. As with the other creation methods, this one does not insert the node into the tree.
Document.getElementsByTagName(tagName)  
Search for all descendants (direct children, children’s children, etc.) with a particular element type name.
Document.getElementsByTagNameNS(namespaceURI, localName)  
Search for all descendants (direct children, children’s children, etc.) with a particular namespace URI and localname. The localname is the part of the namespace after the prefix.
DocumentType.entities  
This is a NamedNodeMap giving the definitions of external entities. For entity names defined more than once, only the first definition is provided (others are ignored as required by the XML recommendation). This may be None if the information is not provided by the parser, or if no entities are defined.
DocumentType.internalSubset  
A string giving the complete internal subset from the document. This does not include the brackets which enclose the subset. If the document has no internal subset, this should be None.
DocumentType.name  
The name of the root element as given in the DOCTYPE declaration, if present.
DocumentType.notations  
This is a NamedNodeMap giving the definitions of notations. For notation names defined more than once, only the first definition is provided (others are ignored as required by the XML recommendation). This may be None if the information is not provided by the parser, or if no notations are defined.
DocumentType.publicId  
The public identifier for the external subset of the document type definition. This will be a string or None.
DocumentType.systemId  
The system identifier for the external subset of the document type definition. This will be a URI as a string, or None.
exception xml.dom.DOMException  
Base exception class used for all specific DOM exceptions. This exception class cannot be directly instantiated.
DOMImplementation.createDocument(namespaceUri, qualifiedName, doctype)  
Return a new Document object (the root of the DOM), with a child Element object having the given namespaceUri and qualifiedName. The doctype must be a DocumentType object created by createDocumentType(), or None. In the Python DOM API, the first two arguments can also be None in order to indicate that no Element child is to be created.
DOMImplementation.createDocumentType(qualifiedName, publicId, systemId)  
Return a new DocumentType object that encapsulates the given qualifiedName, publicId, and systemId strings, representing the information contained in an XML document type declaration.
DOMImplementation.hasFeature(feature, version)  
Return True if the feature identified by the pair of strings feature and version is implemented.
exception xml.dom.DomstringSizeErr  
Raised when a specified range of text does not fit into a string. This is not known to be used in the Python DOM implementations, but may be received from DOM implementations not written in Python.
Element.getAttribute(name)  
Return the value of the attribute named by name as a string. If no such attribute exists, an empty string is returned, as if the attribute had no value.
Element.getAttributeNode(attrname)  
Return the Attr node for the attribute named by attrname.
Element.getAttributeNodeNS(namespaceURI, localName)  
Return an attribute value as a node, given a namespaceURI and localName.
Element.getAttributeNS(namespaceURI, localName)  
Return the value of the attribute named by namespaceURI and localName as a string. If no such attribute exists, an empty string is returned, as if the attribute had no value.
Element.getElementsByTagNameNS(namespaceURI, localName)  
Same as equivalent method in the Document class.
Element.hasAttribute(name)  
Return True if the element has an attribute named by name.
Element.hasAttributeNS(namespaceURI, localName)  
Return True if the element has an attribute named by namespaceURI and localName.
Element.removeAttribute(name)  
Remove an attribute by name. If there is no matching attribute, a NotFoundErr is raised.
Element.removeAttributeNode(oldAttr)  
Remove and return oldAttr from the attribute list, if present. If oldAttr is not present, NotFoundErr is raised.
Element.removeAttributeNS(namespaceURI, localName)  
Remove an attribute by name. Note that it uses a localName, not a qname. No exception is raised if there is no matching attribute.
Element.setAttributeNode(newAttr)  
Add a new attribute node to the element, replacing an existing attribute if necessary if the name attribute matches. If a replacement occurs, the old attribute node will be returned. If newAttr is already in use, InuseAttributeErr will be raised.
Element.setAttributeNodeNS(newAttr)  
Add a new attribute node to the element, replacing an existing attribute if necessary if the namespaceURI and localName attributes match. If a replacement occurs, the old attribute node will be returned. If newAttr is already in use, InuseAttributeErr will be raised.
Element.setAttributeNS(namespaceURI, qname, value)  
Set an attribute value from a string, given a namespaceURI and a qname. Note that a qname is the whole attribute name. This is different than above.
Element.tagName  
The element type name. In a namespace-using document it may have colons in it. The value is a string.
xml.dom.EMPTY_NAMESPACE  
The value used to indicate that no namespace is associated with a node in the DOM. This is typically found as the namespaceURI of a node, or used as the namespaceURI parameter to a namespaces-specific method.
xml.dom.getDOMImplementation(name=None, features=())  
Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns a DOMImplementation object if the import succeeds. If no name is given, and if the environment variable PYTHON_DOM is set, this variable is used to find the implementation. If name is not given, this examines the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature,
version) pairs which are passed to the hasFeature() method on available DOMImplementation objects.
exception xml.dom.HierarchyRequestErr  
Raised when an attempt is made to insert a node where the node type is not allowed.
exception xml.dom.IndexSizeErr  
Raised when an index or size parameter to a method is negative or exceeds the allowed values.
exception xml.dom.InuseAttributeErr  
Raised when an attempt is made to insert an Attr node that is already present elsewhere in the document.
exception xml.dom.InvalidAccessErr  
Raised if a parameter or an operation is not supported on the underlying object.
exception xml.dom.InvalidCharacterErr  
This exception is raised when a string parameter contains a character that is not permitted in the context it’s being used in by the XML 1.0 recommendation. For example, attempting to create an Element node with a space in the element type name will cause this error to be raised.
exception xml.dom.InvalidModificationErr  
Raised when an attempt is made to modify the type of a node.
exception xml.dom.InvalidStateErr  
Raised when an attempt is made to use an object that is not defined or is no longer usable.
Node.toprettyxml(indent="\t", newl="\n", encoding=None, standalone=None)  
Return a pretty-printed version of the document. indent specifies the indentation string and defaults to a tabulator; newl specifies the string emitted at the end of each line and defaults to \n. The encoding argument behaves like the corresponding argument of toxml(). The standalone argument behaves exactly as in writexml().  Changed in version 3.8: The toprettyxml() method now preserves the attribute order specified by the user.