neulab/docprompting-conala huggingface dataset:
class http.server.SimpleHTTPRequestHandler(request, client_address, server, directory=None)  
This class serves files from the current directory and below, directly mapping the directory structure to HTTP requests. A lot of the work, such as parsing the request, is done by the base class BaseHTTPRequestHandler. This class implements the do_GET() and do_HEAD() functions. The following are defined as class-level attributes of SimpleHTTPRequestHandler:  
server_version  
This will be "SimpleHTTP/" + __version__, where __version__ is defined at the module level. 
  
extensions_map  
A dictionary mapping suffixes into MIME types, contains custom overrides for the default system mappings. The mapping is used case-insensitively, and so should contain only lower-cased keys.  Changed in version 3.9: This dictionary is no longer filled with the default system mappings, but only contains overrides.  
  
directory  
If not specified, the directory to serve is the current working directory.  Changed in version 3.9: Accepts a path-like object.  
 The SimpleHTTPRequestHandler class defines the following methods:  
do_HEAD()  
This method serves the 'HEAD' request type: it sends the headers it would send for the equivalent GET request. See the do_GET() method for a more complete explanation of the possible headers. 
  
do_GET()  
The request is mapped to a local file by interpreting the request as a path relative to the current working directory. If the request was mapped to a directory, the directory is checked for a file named index.html or index.htm (in that order). If found, the file’s contents are returned; otherwise a directory listing is generated by calling the list_directory() method. This method uses os.listdir() to scan the directory, and returns a 404 error response if the listdir() fails. If the request was mapped to a file, it is opened. Any OSError exception in opening the requested file is mapped to a 404, 'File not found' error. If there was a 'If-Modified-Since' header in the request, and the file was not modified after this time, a 304, 'Not Modified' response is sent. Otherwise, the content type is guessed by calling the guess_type() method, which in turn uses the extensions_map variable, and the file contents are returned. A 'Content-type:' header with the guessed content type is output, followed by a 'Content-Length:' header with the file’s size and a 'Last-Modified:' header with the file’s modification time. Then follows a blank line signifying the end of the headers, and then the contents of the file are output. If the file’s MIME type starts with text/ the file is opened in text mode; otherwise binary mode is used. For example usage, see the implementation of the test() function invocation in the http.server module.  Changed in version 3.7: Support of the 'If-Modified-Since' header.
directory  
If not specified, the directory to serve is the current working directory.  Changed in version 3.9: Accepts a path-like object.
do_GET()  
The request is mapped to a local file by interpreting the request as a path relative to the current working directory. If the request was mapped to a directory, the directory is checked for a file named index.html or index.htm (in that order). If found, the file’s contents are returned; otherwise a directory listing is generated by calling the list_directory() method. This method uses os.listdir() to scan the directory, and returns a 404 error response if the listdir() fails. If the request was mapped to a file, it is opened. Any OSError exception in opening the requested file is mapped to a 404, 'File not found' error. If there was a 'If-Modified-Since' header in the request, and the file was not modified after this time, a 304, 'Not Modified' response is sent. Otherwise, the content type is guessed by calling the guess_type() method, which in turn uses the extensions_map variable, and the file contents are returned. A 'Content-type:' header with the guessed content type is output, followed by a 'Content-Length:' header with the file’s size and a 'Last-Modified:' header with the file’s modification time. Then follows a blank line signifying the end of the headers, and then the contents of the file are output. If the file’s MIME type starts with text/ the file is opened in text mode; otherwise binary mode is used. For example usage, see the implementation of the test() function invocation in the http.server module.  Changed in version 3.7: Support of the 'If-Modified-Since' header.
do_HEAD()  
This method serves the 'HEAD' request type: it sends the headers it would send for the equivalent GET request. See the do_GET() method for a more complete explanation of the possible headers.
extensions_map  
A dictionary mapping suffixes into MIME types, contains custom overrides for the default system mappings. The mapping is used case-insensitively, and so should contain only lower-cased keys.  Changed in version 3.9: This dictionary is no longer filled with the default system mappings, but only contains overrides.
server_version  
This will be "SimpleHTTP/" + __version__, where __version__ is defined at the module level.
class http.server.ThreadingHTTPServer(server_address, RequestHandlerClass)  
This class is identical to HTTPServer but uses threads to handle requests by using the ThreadingMixIn. This is useful to handle web browsers pre-opening sockets, on which HTTPServer would wait indefinitely.  New in version 3.7.
id(object)  
Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.  CPython implementation detail: This is the address of the object in memory.  Raises an auditing event builtins.id with argument id.
class imaplib.IMAP4(host='', port=IMAP4_PORT, timeout=None)  
This class implements the actual IMAP4 protocol. The connection is created and protocol version (IMAP4 or IMAP4rev1) is determined when the instance is initialized. If host is not specified, '' (the local host) is used. If port is omitted, the standard IMAP4 port (143) is used. The optional timeout parameter specifies a timeout in seconds for the connection attempt. If timeout is not given or is None, the global default socket timeout is used. The IMAP4 class supports the with statement. When used like this, the IMAP4 LOGOUT command is issued automatically when the with statement exits. E.g.: >>> from imaplib import IMAP4
>>> with IMAP4("domain.org") as M:
...     M.noop()
...
('OK', [b'Nothing Accomplished. d25if65hy903weo.87'])
  Changed in version 3.5: Support for the with statement was added.   Changed in version 3.9: The optional timeout parameter was added.
exception IMAP4.abort  
IMAP4 server errors cause this exception to be raised. This is a sub-class of IMAP4.error. Note that closing the instance and instantiating a new one will usually allow recovery from this exception.
IMAP4.append(mailbox, flags, date_time, message)  
Append message to named mailbox.
IMAP4.authenticate(mechanism, authobject)  
Authenticate command — requires response processing. mechanism specifies which authentication mechanism is to be used - it should appear in the instance variable capabilities in the form AUTH=mechanism. authobject must be a callable object: data = authobject(response)
 It will be called to process server continuation responses; the response argument it is passed will be bytes. It should return bytes data that will be base64 encoded and sent to the server. It should return None if the client abort response * should be sent instead.  Changed in version 3.5: string usernames and passwords are now encoded to utf-8 instead of being limited to ASCII.
IMAP4.close()  
Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before LOGOUT.
IMAP4.copy(message_set, new_mailbox)  
Copy message_set messages onto end of new_mailbox.
IMAP4.debug  
Integer value to control debugging output. The initialize value is taken from the module variable Debug. Values greater than three trace each command.
IMAP4.deleteacl(mailbox, who)  
Delete the ACLs (remove any rights) set for who on mailbox.
IMAP4.enable(capability)  
Enable capability (see RFC 5161). Most capabilities do not need to be enabled. Currently only the UTF8=ACCEPT capability is supported (see RFC 6855).  New in version 3.5: The enable() method itself, and RFC 6855 support.
exception IMAP4.error  
Exception raised on any errors. The reason for the exception is passed to the constructor as a string.
IMAP4.expunge()  
Permanently remove deleted items from selected mailbox. Generates an EXPUNGE response for each deleted message. Returned data contains a list of EXPUNGE message numbers in order received.
IMAP4.fetch(message_set, message_parts)  
Fetch (parts of) messages. message_parts should be a string of message part names enclosed within parentheses, eg: "(UID BODY[TEXT])". Returned data are tuples of message part envelope and data.
IMAP4.getacl(mailbox)  
Get the ACLs for mailbox. The method is non-standard, but is supported by the Cyrus server.
IMAP4.getannotation(mailbox, entry, attribute)  
Retrieve the specified ANNOTATIONs for mailbox. The method is non-standard, but is supported by the Cyrus server.
IMAP4.getquota(root)  
Get the quota root’s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
IMAP4.getquotaroot(mailbox)  
Get the list of quota roots for the named mailbox. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
IMAP4.list([directory[, pattern]])  
List mailbox names in directory matching pattern. directory defaults to the top-level mail folder, and pattern defaults to match anything. Returned data contains a list of LIST responses.
IMAP4.login(user, password)  
Identify the client using a plaintext password. The password will be quoted.
IMAP4.login_cram_md5(user, password)  
Force use of CRAM-MD5 authentication when identifying the client to protect the password. Will only work if the server CAPABILITY response includes the phrase AUTH=CRAM-MD5.
IMAP4.logout()  
Shutdown connection to server. Returns server BYE response.  Changed in version 3.8: The method no longer ignores silently arbitrary exceptions.
IMAP4.lsub(directory='""', pattern='*')  
List subscribed mailbox names in directory matching pattern. directory defaults to the top level directory and pattern defaults to match any mailbox. Returned data are tuples of message part envelope and data.
IMAP4.myrights(mailbox)  
Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).
IMAP4.namespace()  
Returns IMAP namespaces as defined in RFC 2342.
IMAP4.open(host, port, timeout=None)  
Opens socket to port at host. The optional timeout parameter specifies a timeout in seconds for the connection attempt. If timeout is not given or is None, the global default socket timeout is used. Also note that if the timeout parameter is set to be zero, it will raise a ValueError to reject creating a non-blocking socket. This method is implicitly called by the IMAP4 constructor. The connection objects established by this method will be used in the IMAP4.read(), IMAP4.readline(), IMAP4.send(), and IMAP4.shutdown() methods. You may override this method. Raises an auditing event imaplib.open with arguments self, host, port.  Changed in version 3.9: The timeout parameter was added.
IMAP4.partial(message_num, message_part, start, length)  
Fetch truncated part of a message. Returned data is a tuple of message part envelope and data.
IMAP4.PROTOCOL_VERSION  
The most recent supported protocol in the CAPABILITY response from the server.
IMAP4.proxyauth(user)  
Assume authentication as user. Allows an authorised administrator to proxy into any user’s mailbox.
IMAP4.read(size)  
Reads size bytes from the remote server. You may override this method.
IMAP4.readline()  
Reads one line from the remote server. You may override this method.
exception IMAP4.readonly  
This exception is raised when a writable mailbox has its status changed by the server. This is a sub-class of IMAP4.error. Some other client now has write permission, and the mailbox will need to be re-opened to re-obtain write permission.
IMAP4.recent()  
Prompt server for an update. Returned data is None if no new messages, else value of RECENT response.
IMAP4.rename(oldmailbox, newmailbox)  
Rename mailbox named oldmailbox to newmailbox.
IMAP4.response(code)  
Return data for response code if received, or None. Returns the given code, instead of the usual type.
IMAP4.search(charset, criterion[, ...])  
Search mailbox for matching messages. charset may be None, in which case no CHARSET will be specified in the request to the server. The IMAP protocol requires that at least one criterion be specified; an exception will be raised when the server returns an error. charset must be None if the UTF8=ACCEPT capability was enabled using the enable() command. Example: # M is a connected IMAP4 instance...
typ, msgnums = M.search(None, 'FROM', '"LDJ"')

# or:
typ, msgnums = M.search(None, '(FROM "LDJ")')
IMAP4.select(mailbox='INBOX', readonly=False)  
Select a mailbox. Returned data is the count of messages in mailbox (EXISTS response). The default mailbox is 'INBOX'. If the readonly flag is set, modifications to the mailbox are not allowed.
IMAP4.send(data)  
Sends data to the remote server. You may override this method. Raises an auditing event imaplib.send with arguments self, data.
IMAP4.setacl(mailbox, who, what)  
Set an ACL for mailbox. The method is non-standard, but is supported by the Cyrus server.
IMAP4.setannotation(mailbox, entry, attribute[, ...])  
Set ANNOTATIONs for mailbox. The method is non-standard, but is supported by the Cyrus server.
IMAP4.setquota(root, limits)  
Set the quota root’s resource limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
IMAP4.shutdown()  
Close connection established in open. This method is implicitly called by IMAP4.logout(). You may override this method.
IMAP4.sort(sort_criteria, charset, search_criterion[, ...])  
The sort command is a variant of search with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. Sort has two arguments before the search_criterion argument(s); a parenthesized list of sort_criteria, and the searching charset. Note that unlike search, the searching charset argument is mandatory. There is also a uid sort command which corresponds to sort the way that uid search corresponds to search. The sort command first searches the mailbox for messages that match the given searching criteria using the charset argument for the interpretation of strings in the searching criteria. It then returns the numbers of matching messages. This is an IMAP4rev1 extension command.
IMAP4.starttls(ssl_context=None)  
Send a STARTTLS command. The ssl_context argument is optional and should be a ssl.SSLContext object. This will enable encryption on the IMAP connection. Please read Security considerations for best practices.  New in version 3.2.   Changed in version 3.4: The method now supports hostname check with ssl.SSLContext.check_hostname and Server Name Indication (see ssl.HAS_SNI).
IMAP4.status(mailbox, names)  
Request named status conditions for mailbox.
IMAP4.store(message_set, command, flag_list)  
Alters flag dispositions for messages in mailbox. command is specified by section 6.4.6 of RFC 2060 as being one of “FLAGS”, “+FLAGS”, or “-FLAGS”, optionally with a suffix of “.SILENT”. For example, to set the delete flag on all messages: typ, data = M.search(None, 'ALL')
for num in data[0].split():
   M.store(num, '+FLAGS', '\\Deleted')
M.expunge()
  Note Creating flags containing ‘]’ (for example: “[test]”) violates RFC 3501 (the IMAP protocol). However, imaplib has historically allowed creation of such tags, and popular IMAP servers, such as Gmail, accept and produce such flags. There are non-Python programs which also create such tags. Although it is an RFC violation and IMAP clients and servers are supposed to be strict, imaplib nonetheless continues to allow such tags to be created for backward compatibility reasons, and as of Python 3.6, handles them if they are sent from the server, since this improves real-world compatibility.
IMAP4.thread(threading_algorithm, charset, search_criterion[, ...])  
The thread command is a variant of search with threading semantics for the results. Returned data contains a space separated list of thread members. Thread members consist of zero or more messages numbers, delimited by spaces, indicating successive parent and child. Thread has two arguments before the search_criterion argument(s); a threading_algorithm, and the searching charset. Note that unlike search, the searching charset argument is mandatory. There is also a uid thread command which corresponds to thread the way that uid
search corresponds to search. The thread command first searches the mailbox for messages that match the given searching criteria using the charset argument for the interpretation of strings in the searching criteria. It then returns the matching messages threaded according to the specified threading algorithm. This is an IMAP4rev1 extension command.
IMAP4.uid(command, arg[, ...])  
Execute command args with messages identified by UID, rather than message number. Returns response appropriate to command. At least one argument must be supplied; if none are provided, the server will return an error and an exception will be raised.
IMAP4.unselect()  
imaplib.IMAP4.unselect() frees server’s resources associated with the selected mailbox and returns the server to the authenticated state. This command performs the same actions as imaplib.IMAP4.close(), except that no messages are permanently removed from the currently selected mailbox.  New in version 3.9.
IMAP4.unsubscribe(mailbox)  
Unsubscribe from old mailbox.
IMAP4.utf8_enabled  
Boolean value that is normally False, but is set to True if an enable() command is successfully issued for the UTF8=ACCEPT capability.  New in version 3.5.
IMAP4.xatom(name[, ...])  
Allow simple extension commands notified by server in CAPABILITY response.
class imaplib.IMAP4_SSL(host='', port=IMAP4_SSL_PORT, keyfile=None, certfile=None, ssl_context=None, timeout=None)  
This is a subclass derived from IMAP4 that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled with SSL support). If host is not specified, '' (the local host) is used. If port is omitted, the standard IMAP4-over-SSL port (993) is used. ssl_context is a ssl.SSLContext object which allows bundling SSL configuration options, certificates and private keys into a single (potentially long-lived) structure. Please read Security considerations for best practices. keyfile and certfile are a legacy alternative to ssl_context - they can point to PEM-formatted private key and certificate chain files for the SSL connection. Note that the keyfile/certfile parameters are mutually exclusive with ssl_context, a ValueError is raised if keyfile/certfile is provided along with ssl_context. The optional timeout parameter specifies a timeout in seconds for the connection attempt. If timeout is not given or is None, the global default socket timeout is used.  Changed in version 3.3: ssl_context parameter was added.   Changed in version 3.4: The class now supports hostname check with ssl.SSLContext.check_hostname and Server Name Indication (see ssl.HAS_SNI).   Deprecated since version 3.6: keyfile and certfile are deprecated in favor of ssl_context. Please use ssl.SSLContext.load_cert_chain() instead, or let ssl.create_default_context() select the system’s trusted CA certificates for you.   Changed in version 3.9: The optional timeout parameter was added.
class imaplib.IMAP4_stream(command)  
This is a subclass derived from IMAP4 that connects to the stdin/stdout file descriptors created by passing command to subprocess.Popen().
imaplib.Int2AP(num)  
Converts an integer into a bytes representation using characters from the set [A .. P].
imaplib.Internaldate2tuple(datestr)  
Parse an IMAP4 INTERNALDATE string and return corresponding local time. The return value is a time.struct_time tuple or None if the string has wrong format.
imaplib.ParseFlags(flagstr)  
Converts an IMAP4 FLAGS response to a tuple of individual flags.
imaplib.Time2Internaldate(date_time)  
Convert date_time to an IMAP4 INTERNALDATE representation. The return value is a string in the form: "DD-Mmm-YYYY HH:MM:SS
+HHMM" (including double-quotes). The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time an instance of time.struct_time (as returned by time.localtime()), an aware instance of datetime.datetime, or a double-quoted string. In the last case, it is assumed to already be in the correct format.
imghdr — Determine the type of an image Source code: Lib/imghdr.py The imghdr module determines the type of image contained in a file or byte stream. The imghdr module defines the following function:  
imghdr.what(filename, h=None)  
Tests the image data contained in the file named by filename, and returns a string describing the image type. If optional h is provided, the filename is ignored and h is assumed to contain the byte stream to test.  Changed in version 3.6: Accepts a path-like object.  
 The following image types are recognized, as listed below with the return value from what():   
Value Image format   
'rgb' SGI ImgLib Files  
'gif' GIF 87a and 89a Files  
'pbm' Portable Bitmap Files  
'pgm' Portable Graymap Files  
'ppm' Portable Pixmap Files  
'tiff' TIFF Files  
'rast' Sun Raster Files  
'xbm' X Bitmap Files  
'jpeg' JPEG data in JFIF or Exif formats  
'bmp' BMP files  
'png' Portable Network Graphics  
'webp' WebP files  
'exr' OpenEXR Files    New in version 3.5: The exr and webp formats were added.  You can extend the list of file types imghdr can recognize by appending to this variable:  
imghdr.tests  
A list of functions performing the individual tests. Each function takes two arguments: the byte-stream and an open file-like object. When what() is called with a byte-stream, the file-like object will be None. The test function should return a string describing the image type if the test succeeded, or None if it failed. 
 Example: >>> import imghdr
>>> imghdr.what('bass.gif')
'gif'
imghdr.tests  
A list of functions performing the individual tests. Each function takes two arguments: the byte-stream and an open file-like object. When what() is called with a byte-stream, the file-like object will be None. The test function should return a string describing the image type if the test succeeded, or None if it failed.
imghdr.what(filename, h=None)  
Tests the image data contained in the file named by filename, and returns a string describing the image type. If optional h is provided, the filename is ignored and h is assumed to contain the byte stream to test.  Changed in version 3.6: Accepts a path-like object.
exception ImportError  
Raised when the import statement has troubles trying to load a module. Also raised when the “from list” in from ... import has a name that cannot be found. The name and path attributes can be set using keyword-only arguments to the constructor. When set they represent the name of the module that was attempted to be imported and the path to any file which triggered the exception, respectively.  Changed in version 3.3: Added the name and path attributes.
class importlib.abc.ExecutionLoader  
An abstract base class which inherits from InspectLoader that, when implemented, helps a module to be executed as a script. The ABC represents an optional PEP 302 protocol.  
abstractmethod get_filename(fullname)  
An abstract method that is to return the value of __file__ for the specified module. If no path is available, ImportError is raised. If source code is available, then the method should return the path to the source file, regardless of whether a bytecode was used to load the module.  Changed in version 3.4: Raises ImportError instead of NotImplementedError.