MCPcopy Index your code
hub / github.com/RustPython/RustPython / IMAP4_stream

Class IMAP4_stream

Lib/imaplib.py:1659–1712  ·  view source on GitHub ↗

IMAP4 client class over a stream Instantiate with: IMAP4_stream(command) "command" - a string that can be passed to subprocess.Popen() for more documentation see the docstring of the parent class IMAP4.

Source from the content-addressed store, hash-verified

1657
1658
1659class IMAP4_stream(IMAP4):
1660
1661 """IMAP4 client class over a stream
1662
1663 Instantiate with: IMAP4_stream(command)
1664
1665 "command" - a string that can be passed to subprocess.Popen()
1666
1667 for more documentation see the docstring of the parent class IMAP4.
1668 """
1669
1670
1671 def __init__(self, command):
1672 self.command = command
1673 IMAP4.__init__(self)
1674
1675
1676 def open(self, host=None, port=None, timeout=None):
1677 """Setup a stream connection.
1678 This connection will be used by the routines:
1679 read, readline, send, shutdown.
1680 """
1681 self.host = None # For compatibility with parent class
1682 self.port = None
1683 self.sock = None
1684 self._file = None
1685 self.process = subprocess.Popen(self.command,
1686 bufsize=DEFAULT_BUFFER_SIZE,
1687 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
1688 shell=True, close_fds=True)
1689 self.writefile = self.process.stdin
1690 self.readfile = self.process.stdout
1691
1692 def read(self, size):
1693 """Read 'size' bytes from remote."""
1694 return self.readfile.read(size)
1695
1696
1697 def readline(self):
1698 """Read line from remote."""
1699 return self.readfile.readline()
1700
1701
1702 def send(self, data):
1703 """Send data to remote."""
1704 self.writefile.write(data)
1705 self.writefile.flush()
1706
1707
1708 def shutdown(self):
1709 """Close I/O established in "open"."""
1710 self.readfile.close()
1711 self.writefile.close()
1712 self.process.wait()
1713
1714
1715

Callers 1

imaplib.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected