neulab/docprompting-conala huggingface dataset:
class lzma.LZMAFile(filename=None, mode="r", *, format=None, check=-1, preset=None, filters=None)  
Open an LZMA-compressed file in binary mode. An LZMAFile can wrap an already-open file object, or operate directly on a named file. The filename argument specifies either the file object to wrap, or the name of the file to open (as a str, bytes or path-like object). When wrapping an existing file object, the wrapped file will not be closed when the LZMAFile is closed. The mode argument can be either "r" for reading (default), "w" for overwriting, "x" for exclusive creation, or "a" for appending. These can equivalently be given as "rb", "wb", "xb" and "ab" respectively. If filename is a file object (rather than an actual file name), a mode of "w" does not truncate the file, and is instead equivalent to "a". When opening a file for reading, the input file may be the concatenation of multiple separate compressed streams. These are transparently decoded as a single logical stream. When opening a file for reading, the format and filters arguments have the same meanings as for LZMADecompressor. In this case, the check and preset arguments should not be used. When opening a file for writing, the format, check, preset and filters arguments have the same meanings as for LZMACompressor. LZMAFile supports all the members specified by io.BufferedIOBase, except for detach() and truncate(). Iteration and the with statement are supported. The following method is also provided:  
peek(size=-1)  
Return buffered data without advancing the file position. At least one byte of data will be returned, unless EOF has been reached. The exact number of bytes returned is unspecified (the size argument is ignored).  Note While calling peek() does not change the file position of the LZMAFile, it may change the position of the underlying file object (e.g. if the LZMAFile was constructed by passing a file object for filename).  
  Changed in version 3.4: Added support for the "x" and "xb" modes.   Changed in version 3.5: The read() method now accepts an argument of None.   Changed in version 3.6: Accepts a path-like object.
peek(size=-1)  
Return buffered data without advancing the file position. At least one byte of data will be returned, unless EOF has been reached. The exact number of bytes returned is unspecified (the size argument is ignored).  Note While calling peek() does not change the file position of the LZMAFile, it may change the position of the underlying file object (e.g. if the LZMAFile was constructed by passing a file object for filename).
lzma.open(filename, mode="rb", *, format=None, check=-1, preset=None, filters=None, encoding=None, errors=None, newline=None)  
Open an LZMA-compressed file in binary or text mode, returning a file object. The filename argument can be either an actual file name (given as a str, bytes or path-like object), in which case the named file is opened, or it can be an existing file object to read from or write to. The mode argument can be any of "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text mode. The default is "rb". When opening a file for reading, the format and filters arguments have the same meanings as for LZMADecompressor. In this case, the check and preset arguments should not be used. When opening a file for writing, the format, check, preset and filters arguments have the same meanings as for LZMACompressor. For binary mode, this function is equivalent to the LZMAFile constructor: LZMAFile(filename, mode, ...). In this case, the encoding, errors and newline arguments must not be provided. For text mode, a LZMAFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s).  Changed in version 3.4: Added support for the "x", "xb" and "xt" modes.   Changed in version 3.6: Accepts a path-like object.
class mailbox.Babyl(path, factory=None, create=True)  
A subclass of Mailbox for mailboxes in Babyl format. Parameter factory is a callable object that accepts a file-like message representation (which behaves as if opened in binary mode) and returns a custom representation. If factory is None, BabylMessage is used as the default message representation. If create is True, the mailbox is created if it does not exist. Babyl is a single-file mailbox format used by the Rmail mail user agent included with Emacs. The beginning of a message is indicated by a line containing the two characters Control-Underscore ('\037') and Control-L ('\014'). The end of a message is indicated by the start of the next message or, in the case of the last message, a line containing a Control-Underscore ('\037') character. Messages in a Babyl mailbox have two sets of headers, original headers and so-called visible headers. Visible headers are typically a subset of the original headers that have been reformatted or abridged to be more attractive. Each message in a Babyl mailbox also has an accompanying list of labels, or short strings that record extra information about the message, and a list of all user-defined labels found in the mailbox is kept in the Babyl options section. Babyl instances have all of the methods of Mailbox in addition to the following:  
get_labels()  
Return a list of the names of all user-defined labels used in the mailbox.  Note The actual messages are inspected to determine which labels exist in the mailbox rather than consulting the list of labels in the Babyl options section, but the Babyl section is updated whenever the mailbox is modified.  
 Some Mailbox methods implemented by Babyl deserve special remarks:  
get_file(key)  
In Babyl mailboxes, the headers of a message are not stored contiguously with the body of the message. To generate a file-like representation, the headers and body are copied together into an io.BytesIO instance, which has an API identical to that of a file. As a result, the file-like object is truly independent of the underlying mailbox but does not save memory compared to a string representation. 
  
lock()  
unlock()  
Three locking mechanisms are used—dot locking and, if available, the flock() and lockf() system calls.
get_file(key)  
In Babyl mailboxes, the headers of a message are not stored contiguously with the body of the message. To generate a file-like representation, the headers and body are copied together into an io.BytesIO instance, which has an API identical to that of a file. As a result, the file-like object is truly independent of the underlying mailbox but does not save memory compared to a string representation.
get_labels()  
Return a list of the names of all user-defined labels used in the mailbox.  Note The actual messages are inspected to determine which labels exist in the mailbox rather than consulting the list of labels in the Babyl options section, but the Babyl section is updated whenever the mailbox is modified.
lock()  
unlock()  
Three locking mechanisms are used—dot locking and, if available, the flock() and lockf() system calls.
class mailbox.BabylMessage(message=None)  
A message with Babyl-specific behaviors. Parameter message has the same meaning as with the Message constructor. Certain message labels, called attributes, are defined by convention to have special meanings. The attributes are as follows:   
Label Explanation   
unseen Not read, but previously detected by MUA  
deleted Marked for subsequent deletion  
filed Copied to another file or mailbox  
answered Replied to  
forwarded Forwarded  
edited Modified by the user  
resent Resent   By default, Rmail displays only visible headers. The BabylMessage class, though, uses the original headers because they are more complete. Visible headers may be accessed explicitly if desired. BabylMessage instances offer the following methods:  
get_labels()  
Return a list of labels on the message. 
  
set_labels(labels)  
Set the list of labels on the message to labels. 
  
add_label(label)  
Add label to the list of labels on the message. 
  
remove_label(label)  
Remove label from the list of labels on the message. 
  
get_visible()  
Return an Message instance whose headers are the message’s visible headers and whose body is empty. 
  
set_visible(visible)  
Set the message’s visible headers to be the same as the headers in message. Parameter visible should be a Message instance, an email.message.Message instance, a string, or a file-like object (which should be open in text mode). 
  
update_visible()  
When a BabylMessage instance’s original headers are modified, the visible headers are not automatically modified to correspond. This method updates the visible headers as follows: each visible header with a corresponding original header is set to the value of the original header, each visible header without a corresponding original header is removed, and any of Date, From, Reply-To, To, CC, and Subject that are present in the original headers but not the visible headers are added to the visible headers.
get_visible()  
Return an Message instance whose headers are the message’s visible headers and whose body is empty.
set_visible(visible)  
Set the message’s visible headers to be the same as the headers in message. Parameter visible should be a Message instance, an email.message.Message instance, a string, or a file-like object (which should be open in text mode).
update_visible()  
When a BabylMessage instance’s original headers are modified, the visible headers are not automatically modified to correspond. This method updates the visible headers as follows: each visible header with a corresponding original header is set to the value of the original header, each visible header without a corresponding original header is removed, and any of Date, From, Reply-To, To, CC, and Subject that are present in the original headers but not the visible headers are added to the visible headers.
exception mailbox.ExternalClashError  
Raised when some mailbox-related condition beyond the control of the program causes it to be unable to proceed, such as when failing to acquire a lock that another program already holds a lock, or when a uniquely-generated file name already exists.
exception mailbox.FormatError  
Raised when the data in a file cannot be parsed, such as when an MH instance attempts to read a corrupted .mh_sequences file.
add(message)  
Add message to the mailbox and return the key that has been assigned to it. Parameter message may be a Message instance, an email.message.Message instance, a string, a byte string, or a file-like object (which should be open in binary mode). If message is an instance of the appropriate format-specific Message subclass (e.g., if it’s an mboxMessage instance and this is an mbox instance), its format-specific information is used. Otherwise, reasonable defaults for format-specific information are used.  Changed in version 3.2: Support for binary input was added.
close()  
Flush the mailbox, unlock it if necessary, and close any open files. For some Mailbox subclasses, this method does nothing.
remove(key)  
__delitem__(key)  
discard(key)  
Delete the message corresponding to key from the mailbox. If no such message exists, a KeyError exception is raised if the method was called as remove() or __delitem__() but no exception is raised if the method was called as discard(). The behavior of discard() may be preferred if the underlying mailbox format supports concurrent modification by other processes.
flush()  
Write any pending changes to the filesystem. For some Mailbox subclasses, changes are always written immediately and flush() does nothing, but you should still make a habit of calling this method.
get(key, default=None)  
__getitem__(key)  
Return a representation of the message corresponding to key. If no such message exists, default is returned if the method was called as get() and a KeyError exception is raised if the method was called as __getitem__(). The message is represented as an instance of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.
get_bytes(key)  
Return a byte representation of the message corresponding to key, or raise a KeyError exception if no such message exists.  New in version 3.2.
get_file(key)  
Return a file-like representation of the message corresponding to key, or raise a KeyError exception if no such message exists. The file-like object behaves as if open in binary mode. This file should be closed once it is no longer needed.  Changed in version 3.2: The file object really is a binary file; previously it was incorrectly returned in text mode. Also, the file-like object now supports the context management protocol: you can use a with statement to automatically close it.   Note Unlike other representations of messages, file-like representations are not necessarily independent of the Mailbox instance that created them or of the underlying mailbox. More specific documentation is provided by each subclass.
get_message(key)  
Return a representation of the message corresponding to key as an instance of the appropriate format-specific Message subclass, or raise a KeyError exception if no such message exists.
get_string(key)  
Return a string representation of the message corresponding to key, or raise a KeyError exception if no such message exists. The message is processed through email.message.Message to convert it to a 7bit clean representation.
iteritems()  
items()  
Return an iterator over (key, message) pairs, where key is a key and message is a message representation, if called as iteritems() or return a list of such pairs if called as items(). The messages are represented as instances of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.
iterkeys()  
keys()  
Return an iterator over all keys if called as iterkeys() or return a list of keys if called as keys().
itervalues()  
__iter__()  
values()  
Return an iterator over representations of all messages if called as itervalues() or __iter__() or return a list of such representations if called as values(). The messages are represented as instances of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.  Note The behavior of __iter__() is unlike that of dictionaries, which iterate over keys.
lock()  
Acquire an exclusive advisory lock on the mailbox so that other processes know not to modify it. An ExternalClashError is raised if the lock is not available. The particular locking mechanisms used depend upon the mailbox format. You should always lock the mailbox before making any modifications to its contents.
pop(key, default=None)  
Return a representation of the message corresponding to key and delete the message. If no such message exists, return default. The message is represented as an instance of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.
popitem()  
Return an arbitrary (key, message) pair, where key is a key and message is a message representation, and delete the corresponding message. If the mailbox is empty, raise a KeyError exception. The message is represented as an instance of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.
update(arg)  
Parameter arg should be a key-to-message mapping or an iterable of (key, message) pairs. Updates the mailbox so that, for each given key and message, the message corresponding to key is set to message as if by using __setitem__(). As with __setitem__(), each key must already correspond to a message in the mailbox or else a KeyError exception will be raised, so in general it is incorrect for arg to be a Mailbox instance.  Note Unlike with dictionaries, keyword arguments are not supported.
__setitem__(key, message)  
Replace the message corresponding to key with message. Raise a KeyError exception if no message already corresponds to key. As with add(), parameter message may be a Message instance, an email.message.Message instance, a string, a byte string, or a file-like object (which should be open in binary mode). If message is an instance of the appropriate format-specific Message subclass (e.g., if it’s an mboxMessage instance and this is an mbox instance), its format-specific information is used. Otherwise, the format-specific information of the message that currently corresponds to key is left unchanged.
add(message)  
__setitem__(key, message)  
update(arg)  
 Warning These methods generate unique file names based upon the current process ID. When using multiple threads, undetected name clashes may occur and cause corruption of the mailbox unless threads are coordinated to avoid using these methods to manipulate the same mailbox simultaneously.
add_folder(folder)  
Create a folder whose name is folder and return a Maildir instance representing it.
clean()  
Delete temporary files from the mailbox that have not been accessed in the last 36 hours. The Maildir specification says that mail-reading programs should do this occasionally.
close()  
Maildir instances do not keep any open files and the underlying mailboxes do not support locking, so this method does nothing.
flush()  
All changes to Maildir mailboxes are immediately applied, so this method does nothing.
get_file(key)  
Depending upon the host platform, it may not be possible to modify or remove the underlying message while the returned file remains open.
get_folder(folder)  
Return a Maildir instance representing the folder whose name is folder. A NoSuchMailboxError exception is raised if the folder does not exist.
lock()  
unlock()  
Maildir mailboxes do not support (or require) locking, so these methods do nothing.
remove_folder(folder)  
Delete the folder whose name is folder. If the folder contains any messages, a NotEmptyError exception will be raised and the folder will not be deleted.
class mailbox.MaildirMessage(message=None)  
A message with Maildir-specific behaviors. Parameter message has the same meaning as with the Message constructor. Typically, a mail user agent application moves all of the messages in the new subdirectory to the cur subdirectory after the first time the user opens and closes the mailbox, recording that the messages are old whether or not they’ve actually been read. Each message in cur has an “info” section added to its file name to store information about its state. (Some mail readers may also add an “info” section to messages in new.) The “info” section may take one of two forms: it may contain “2,” followed by a list of standardized flags (e.g., “2,FR”) or it may contain “1,” followed by so-called experimental information. Standard flags for Maildir messages are as follows:   
Flag Meaning Explanation   
D Draft Under composition  
F Flagged Marked as important  
P Passed Forwarded, resent, or bounced  
R Replied Replied to  
S Seen Read  
T Trashed Marked for subsequent deletion   MaildirMessage instances offer the following methods:  
get_subdir()  
Return either “new” (if the message should be stored in the new subdirectory) or “cur” (if the message should be stored in the cur subdirectory).  Note A message is typically moved from new to cur after its mailbox has been accessed, whether or not the message is has been read. A message msg has been read if "S" in msg.get_flags() is True.  
  
set_subdir(subdir)  
Set the subdirectory the message should be stored in. Parameter subdir must be either “new” or “cur”. 
  
get_flags()  
Return a string specifying the flags that are currently set. If the message complies with the standard Maildir format, the result is the concatenation in alphabetical order of zero or one occurrence of each of 'D', 'F', 'P', 'R', 'S', and 'T'. The empty string is returned if no flags are set or if “info” contains experimental semantics. 
  
set_flags(flags)  
Set the flags specified by flags and unset all others. 
  
add_flag(flag)  
Set the flag(s) specified by flag without changing other flags. To add more than one flag at a time, flag may be a string of more than one character. The current “info” is overwritten whether or not it contains experimental information rather than flags. 
  
remove_flag(flag)  
Unset the flag(s) specified by flag without changing other flags. To remove more than one flag at a time, flag maybe a string of more than one character. If “info” contains experimental information rather than flags, the current “info” is not modified. 
  
get_date()  
Return the delivery date of the message as a floating-point number representing seconds since the epoch. 
  
set_date(date)  
Set the delivery date of the message to date, a floating-point number representing seconds since the epoch. 
  
get_info()  
Return a string containing the “info” for a message. This is useful for accessing and modifying “info” that is experimental (i.e., not a list of flags). 
  
set_info(info)  
Set “info” to info, which should be a string.
add_flag(flag)  
Set the flag(s) specified by flag without changing other flags. To add more than one flag at a time, flag may be a string of more than one character. The current “info” is overwritten whether or not it contains experimental information rather than flags.
get_date()  
Return the delivery date of the message as a floating-point number representing seconds since the epoch.
get_flags()  
Return a string specifying the flags that are currently set. If the message complies with the standard Maildir format, the result is the concatenation in alphabetical order of zero or one occurrence of each of 'D', 'F', 'P', 'R', 'S', and 'T'. The empty string is returned if no flags are set or if “info” contains experimental semantics.
get_info()  
Return a string containing the “info” for a message. This is useful for accessing and modifying “info” that is experimental (i.e., not a list of flags).
get_subdir()  
Return either “new” (if the message should be stored in the new subdirectory) or “cur” (if the message should be stored in the cur subdirectory).  Note A message is typically moved from new to cur after its mailbox has been accessed, whether or not the message is has been read. A message msg has been read if "S" in msg.get_flags() is True.
remove_flag(flag)  
Unset the flag(s) specified by flag without changing other flags. To remove more than one flag at a time, flag maybe a string of more than one character. If “info” contains experimental information rather than flags, the current “info” is not modified.
set_date(date)  
Set the delivery date of the message to date, a floating-point number representing seconds since the epoch.
set_info(info)  
Set “info” to info, which should be a string.
set_subdir(subdir)  
Set the subdirectory the message should be stored in. Parameter subdir must be either “new” or “cur”.