neulab/docprompting-conala huggingface dataset:
SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=(), rcpt_options=())  
This is a convenience method for calling sendmail() with the message represented by an email.message.Message object. The arguments have the same meaning as for sendmail(), except that msg is a Message object. If from_addr is None or to_addrs is None, send_message fills those arguments with addresses extracted from the headers of msg as specified in RFC 5322: from_addr is set to the Sender field if it is present, and otherwise to the From field. to_addrs combines the values (if any) of the To, Cc, and Bcc fields from msg. If exactly one set of Resent-* headers appear in the message, the regular headers are ignored and the Resent-* headers are used instead. If the message contains more than one set of Resent-* headers, a ValueError is raised, since there is no way to unambiguously detect the most recent set of Resent- headers. send_message serializes msg using BytesGenerator with \r\n as the linesep, and calls sendmail() to transmit the resulting message. Regardless of the values of from_addr and to_addrs, send_message does not transmit any Bcc or Resent-Bcc headers that may appear in msg. If any of the addresses in from_addr and to_addrs contain non-ASCII characters and the server does not advertise SMTPUTF8 support, an SMTPNotSupported error is raised. Otherwise the Message is serialized with a clone of its policy with the utf8 attribute set to True, and SMTPUTF8 and BODY=8BITMIME are added to mail_options.  New in version 3.2.   New in version 3.5: Support for internationalized addresses (SMTPUTF8).
SMTP.set_debuglevel(level)  
Set the debug output level. A value of 1 or True for level results in debug messages for connection and for all messages sent to and received from the server. A value of 2 for level results in these messages being timestamped.  Changed in version 3.5: Added debuglevel 2.
SMTP.starttls(keyfile=None, certfile=None, context=None)  
Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that follow will be encrypted. You should then call ehlo() again. If keyfile and certfile are provided, they are used to create an ssl.SSLContext. Optional context parameter is an ssl.SSLContext object; This is an alternative to using a keyfile and a certfile and if specified both keyfile and certfile should be None. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first.  Deprecated since version 3.6: keyfile and certfile are deprecated in favor of context. Please use ssl.SSLContext.load_cert_chain() instead, or let ssl.create_default_context() select the system’s trusted CA certificates for you.   
SMTPHeloError


The server didn’t reply properly to the HELO greeting.  
SMTPNotSupportedError


The server does not support the STARTTLS extension.  
RuntimeError


SSL/TLS support is not available to your Python interpreter.    Changed in version 3.3: context was added.   Changed in version 3.4: The method now supports hostname check with SSLContext.check_hostname and Server Name Indicator (see HAS_SNI).   Changed in version 3.5: The error raised for lack of STARTTLS support is now the SMTPNotSupportedError subclass instead of the base SMTPException.
SMTP.verify(address)  
Check the validity of an address on this server using SMTP VRFY. Returns a tuple consisting of code 250 and a full RFC 822 address (including human name) if the user address is valid. Otherwise returns an SMTP error code of 400 or greater and an error string.  Note Many sites disable SMTP VRFY in order to foil spammers.
exception smtplib.SMTPAuthenticationError  
SMTP authentication went wrong. Most probably the server didn’t accept the username/password combination provided.
exception smtplib.SMTPConnectError  
Error occurred during establishment of a connection with the server.
exception smtplib.SMTPDataError  
The SMTP server refused to accept the message data.
exception smtplib.SMTPException  
Subclass of OSError that is the base exception class for all the other exceptions provided by this module.  Changed in version 3.4: SMTPException became subclass of OSError
exception smtplib.SMTPHeloError  
The server refused our HELO message.
exception smtplib.SMTPNotSupportedError  
The command or option attempted is not supported by the server.  New in version 3.5.
exception smtplib.SMTPRecipientsRefused  
All recipient addresses refused. The errors for each recipient are accessible through the attribute recipients, which is a dictionary of exactly the same sort as SMTP.sendmail() returns.
exception smtplib.SMTPResponseException  
Base class for all exceptions that include an SMTP error code. These exceptions are generated in some instances when the SMTP server returns an error code. The error code is stored in the smtp_code attribute of the error, and the smtp_error attribute is set to the error message.
exception smtplib.SMTPSenderRefused  
Sender address refused. In addition to the attributes set by on all SMTPResponseException exceptions, this sets ‘sender’ to the string that the SMTP server refused.
exception smtplib.SMTPServerDisconnected  
This exception is raised when the server unexpectedly disconnects, or when an attempt is made to use the SMTP instance before connecting it to a server.
class smtplib.SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None, [timeout, ]context=None, source_address=None)  
An SMTP_SSL instance behaves exactly the same as instances of SMTP. SMTP_SSL should be used for situations where SSL is required from the beginning of the connection and using starttls() is not appropriate. If host is not specified, the local host is used. If port is zero, the standard SMTP-over-SSL port (465) is used. The optional arguments local_hostname, timeout and source_address have the same meaning as they do in the SMTP class. context, also optional, can contain a SSLContext and allows configuring various aspects of the secure connection. Please read Security considerations for best practices. keyfile and certfile are a legacy alternative to context, and can point to a PEM formatted private key and certificate chain file for the SSL connection.  Changed in version 3.3: context was added.   Changed in version 3.3: source_address argument 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 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: If the timeout parameter is set to be zero, it will raise a ValueError to prevent the creation of a non-blocking socket
sndhdr — Determine type of sound file Source code: Lib/sndhdr.py The sndhdr provides utility functions which attempt to determine the type of sound data which is in a file. When these functions are able to determine what type of sound data is stored in a file, they return a namedtuple(), containing five attributes: (filetype, framerate, nchannels, nframes, sampwidth). The value for type indicates the data type and will be one of the strings 'aifc', 'aiff', 'au', 'hcom', 'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'. The sampling_rate will be either the actual value or 0 if unknown or difficult to decode. Similarly, channels will be either the number of channels or 0 if it cannot be determined or if the value is difficult to decode. The value for frames will be either the number of frames or -1. The last item in the tuple, bits_per_sample, will either be the sample size in bits or 'A' for A-LAW or 'U' for u-LAW.  
sndhdr.what(filename)  
Determines the type of sound data stored in the file filename using whathdr(). If it succeeds, returns a namedtuple as described above, otherwise None is returned.  Changed in version 3.5: Result changed from a tuple to a namedtuple.  
  
sndhdr.whathdr(filename)  
Determines the type of sound data stored in a file based on the file header. The name of the file is given by filename. This function returns a namedtuple as described above on success, or None.  Changed in version 3.5: Result changed from a tuple to a namedtuple.
sndhdr.what(filename)  
Determines the type of sound data stored in the file filename using whathdr(). If it succeeds, returns a namedtuple as described above, otherwise None is returned.  Changed in version 3.5: Result changed from a tuple to a namedtuple.
sndhdr.whathdr(filename)  
Determines the type of sound data stored in a file based on the file header. The name of the file is given by filename. This function returns a namedtuple as described above on success, or None.  Changed in version 3.5: Result changed from a tuple to a namedtuple.
socket.AF_ALG  
socket.SOL_ALG  
ALG_*  
Constants for Linux Kernel cryptography. Availability: Linux >= 2.6.38.  New in version 3.6.
socket.AF_CAN  
socket.PF_CAN  
SOL_CAN_*  
CAN_*  
Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.25.  New in version 3.3.
socket.AF_UNIX  
socket.AF_INET  
socket.AF_INET6  
These constants represent the address (and protocol) families, used for the first argument to socket(). If the AF_UNIX constant is not defined then this protocol is unsupported. More constants may be available depending on the system.
socket.AF_LINK  
Availability: BSD, OSX.  New in version 3.4.
socket.AF_PACKET  
socket.PF_PACKET  
PACKET_*  
Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.2.
socket.AF_QIPCRTR  
Constant for Qualcomm’s IPC router protocol, used to communicate with service providing remote processors. Availability: Linux >= 4.7.
socket.AF_RDS  
socket.PF_RDS  
socket.SOL_RDS  
RDS_*  
Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.30.  New in version 3.3.
socket.AF_VSOCK  
socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID  
VMADDR*  
SO_VM*  
Constants for Linux host/guest communication. Availability: Linux >= 4.8.  New in version 3.7.
socket.BDADDR_ANY  
socket.BDADDR_LOCAL  
These are string constants containing Bluetooth addresses with special meanings. For example, BDADDR_ANY can be used to indicate any address when specifying the binding socket with BTPROTO_RFCOMM.
socket.CAN_BCM  
CAN_BCM_*  
CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) protocol. Broadcast manager constants, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.25.  Note The CAN_BCM_CAN_FD_FRAME flag is only available on Linux >= 4.8.   New in version 3.4.
socket.CAN_ISOTP  
CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. ISO-TP constants, documented in the Linux documentation. Availability: Linux >= 2.6.25.  New in version 3.7.
socket.CAN_J1939  
CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 constants, documented in the Linux documentation. Availability: Linux >= 5.4.  New in version 3.9.
socket.CAN_RAW_FD_FRAMES  
Enables CAN FD support in a CAN_RAW socket. This is disabled by default. This allows your application to send both CAN and CAN FD frames; however, you must accept both CAN and CAN FD frames when reading from the socket. This constant is documented in the Linux documentation. Availability: Linux >= 3.6.  New in version 3.5.
socket.CAN_RAW_JOIN_FILTERS  
Joins the applied CAN filters such that only CAN frames that match all given CAN filters are passed to user space. This constant is documented in the Linux documentation. Availability: Linux >= 4.1.  New in version 3.9.
socket.close(fd)  
Close a socket file descriptor. This is like os.close(), but for sockets. On some platforms (most noticeable Windows) os.close() does not work for socket file descriptors.  New in version 3.7.
socket.CMSG_LEN(length)  
Return the total length, without trailing padding, of an ancillary data item with associated data of the given length. This value can often be used as the buffer size for recvmsg() to receive a single item of ancillary data, but RFC 3542 requires portable applications to use CMSG_SPACE() and thus include space for padding, even when the item will be the last in the buffer. Raises OverflowError if length is outside the permissible range of values. Availability: most Unix platforms, possibly others.  New in version 3.3.
socket.CMSG_SPACE(length)  
Return the buffer size needed for recvmsg() to receive an ancillary data item with associated data of the given length, along with any trailing padding. The buffer space needed to receive multiple items is the sum of the CMSG_SPACE() values for their associated data lengths. Raises OverflowError if length is outside the permissible range of values. Note that some systems might support ancillary data without providing this function. Also note that setting the buffer size using the results of this function may not precisely limit the amount of ancillary data that can be received, since additional data may be able to fit into the padding area. Availability: most Unix platforms, possibly others.  New in version 3.3.
socket.create_connection(address[, timeout[, source_address]])  
Connect to a TCP service listening on the Internet address (a 2-tuple (host, port)), and return the socket object. This is a higher-level function than socket.connect(): if host is a non-numeric hostname, it will try to resolve it for both AF_INET and AF_INET6, and then try to connect to all possible addresses in turn until a connection succeeds. This makes it easy to write clients that are compatible to both IPv4 and IPv6. Passing the optional timeout parameter will set the timeout on the socket instance before attempting to connect. If no timeout is supplied, the global default timeout setting returned by getdefaulttimeout() is used. If supplied, source_address must be a 2-tuple (host, port) for the socket to bind to as its source address before connecting. If host or port are ‘’ or 0 respectively the OS default behavior will be used.  Changed in version 3.2: source_address was added.
socket.create_server(address, *, family=AF_INET, backlog=None, reuse_port=False, dualstack_ipv6=False)  
Convenience function which creates a TCP socket bound to address (a 2-tuple (host, port)) and return the socket object. family should be either AF_INET or AF_INET6. backlog is the queue size passed to socket.listen(); when 0 a default reasonable value is chosen. reuse_port dictates whether to set the SO_REUSEPORT socket option. If dualstack_ipv6 is true and the platform supports it the socket will be able to accept both IPv4 and IPv6 connections, else it will raise ValueError. Most POSIX platforms and Windows are supposed to support this functionality. When this functionality is enabled the address returned by socket.getpeername() when an IPv4 connection occurs will be an IPv6 address represented as an IPv4-mapped IPv6 address. If dualstack_ipv6 is false it will explicitly disable this functionality on platforms that enable it by default (e.g. Linux). This parameter can be used in conjunction with has_dualstack_ipv6(): import socket

addr = ("", 8080)  # all interfaces, port 8080
if socket.has_dualstack_ipv6():
    s = socket.create_server(addr, family=socket.AF_INET6, dualstack_ipv6=True)
else:
    s = socket.create_server(addr)
  Note On POSIX platforms the SO_REUSEADDR socket option is set in order to immediately reuse previous sockets which were bound on the same address and remained in TIME_WAIT state.   New in version 3.8.
exception socket.error  
A deprecated alias of OSError.  Changed in version 3.3: Following PEP 3151, this class was made an alias of OSError.
socket.fromfd(fd, family, type, proto=0)  
Duplicate the file descriptor fd (an integer as returned by a file object’s fileno() method) and build a socket object from the result. Address family, socket type and protocol number are as for the socket() function above. The file descriptor should refer to a socket, but this is not checked — subsequent operations on the object may fail if the file descriptor is invalid. This function is rarely needed, but can be used to get or set socket options on a socket passed to a program as standard input or output (such as a server started by the Unix inet daemon). The socket is assumed to be in blocking mode. The newly created socket is non-inheritable.  Changed in version 3.4: The returned socket is now non-inheritable.
socket.fromshare(data)  
Instantiate a socket from data obtained from the socket.share() method. The socket is assumed to be in blocking mode. Availability: Windows.  New in version 3.3.
exception socket.gaierror  
A subclass of OSError, this exception is raised for address-related errors by getaddrinfo() and getnameinfo(). The accompanying value is a pair (error, string) representing an error returned by a library call. string represents the description of error, as returned by the gai_strerror() C function. The numeric error value will match one of the EAI_* constants defined in this module.  Changed in version 3.3: This class was made a subclass of OSError.
socket.getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)  
Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. The flags argument can be one or several of the AI_* constants, and will influence how results are computed and returned. For example, AI_NUMERICHOST will disable domain name resolution and will raise an error if host is a domain name. The function returns a list of 5-tuples with the following structure: (family, type, proto, canonname, sockaddr) In these tuples, family, type, proto are all integers and are meant to be passed to the socket() function. canonname will be a string representing the canonical name of the host if AI_CANONNAME is part of the flags argument; else canonname will be empty. sockaddr is a tuple describing a socket address, whose format depends on the returned family (a (address, port) 2-tuple for AF_INET, a (address, port, flowinfo, scope_id) 4-tuple for AF_INET6), and is meant to be passed to the socket.connect() method. Raises an auditing event socket.getaddrinfo with arguments host, port, family, type, protocol. The following example fetches address information for a hypothetical TCP connection to example.org on port 80 (results may differ on your system if IPv6 isn’t enabled): >>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
[(<AddressFamily.AF_INET6: 10>, <SocketType.SOCK_STREAM: 1>,
 6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),
 (<AddressFamily.AF_INET: 2>, <SocketType.SOCK_STREAM: 1>,
 6, '', ('93.184.216.34', 80))]
  Changed in version 3.2: parameters can now be passed using keyword arguments.   Changed in version 3.7: for IPv6 multicast addresses, string representing an address will not contain %scope_id part.
socket.getdefaulttimeout()  
Return the default timeout in seconds (float) for new socket objects. A value of None indicates that new socket objects have no timeout. When the socket module is first imported, the default is None.
socket.getfqdn([name])  
Return a fully qualified domain name for name. If name is omitted or empty, it is interpreted as the local host. To find the fully qualified name, the hostname returned by gethostbyaddr() is checked, followed by aliases for the host, if available. The first name which includes a period is selected. In case no fully qualified domain name is available, the hostname as returned by gethostname() is returned.
socket.gethostbyaddr(ip_address)  
Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4/v6 addresses for the same interface on the same host (most likely containing only a single address). To find the fully qualified domain name, use the function getfqdn(). gethostbyaddr() supports both IPv4 and IPv6. Raises an auditing event socket.gethostbyaddr with argument ip_address.
socket.gethostbyname(hostname)  
Translate a host name to IPv4 address format. The IPv4 address is returned as a string, such as '100.50.200.5'. If the host name is an IPv4 address itself it is returned unchanged. See gethostbyname_ex() for a more complete interface. gethostbyname() does not support IPv6 name resolution, and getaddrinfo() should be used instead for IPv4/v6 dual stack support. Raises an auditing event socket.gethostbyname with argument hostname.
socket.gethostbyname_ex(hostname)  
Translate a host name to IPv4 address format, extended interface. Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4 addresses for the same interface on the same host (often but not always a single address). gethostbyname_ex() does not support IPv6 name resolution, and getaddrinfo() should be used instead for IPv4/v6 dual stack support. Raises an auditing event socket.gethostbyname with argument hostname.
socket.gethostname()  
Return a string containing the hostname of the machine where the Python interpreter is currently executing. Raises an auditing event socket.gethostname with no arguments. Note: gethostname() doesn’t always return the fully qualified domain name; use getfqdn() for that.
socket.getnameinfo(sockaddr, flags)  
Translate a socket address sockaddr into a 2-tuple (host, port). Depending on the settings of flags, the result can contain a fully-qualified domain name or numeric address representation in host. Similarly, port can contain a string port name or a numeric port number. For IPv6 addresses, %scope_id is appended to the host part if sockaddr contains meaningful scope_id. Usually this happens for multicast addresses. For more information about flags you can consult getnameinfo(3). Raises an auditing event socket.getnameinfo with argument sockaddr.
socket.getprotobyname(protocolname)  
Translate an Internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function. This is usually only needed for sockets opened in “raw” mode (SOCK_RAW); for the normal socket modes, the correct protocol is chosen automatically if the protocol is omitted or zero.
socket.getservbyname(servicename[, protocolname])  
Translate an Internet service name and protocol name to a port number for that service. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. Raises an auditing event socket.getservbyname with arguments servicename, protocolname.
socket.getservbyport(port[, protocolname])  
Translate an Internet port number and protocol name to a service name for that service. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. Raises an auditing event socket.getservbyport with arguments port, protocolname.
socket.has_dualstack_ipv6()  
Return True if the platform supports creating a TCP socket which can handle both IPv4 and IPv6 connections.  New in version 3.8.
socket.has_ipv6  
This constant contains a boolean value which indicates if IPv6 is supported on this platform.
socket.HCI_FILTER  
socket.HCI_TIME_STAMP  
socket.HCI_DATA_DIR  
For use with BTPROTO_HCI. HCI_FILTER is not available for NetBSD or DragonFlyBSD. HCI_TIME_STAMP and HCI_DATA_DIR are not available for FreeBSD, NetBSD, or DragonFlyBSD.