MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / IMAP4_stream

Class IMAP4_stream

tools/python-3.11.9-amd64/Lib/imaplib.py:1341–1394  ·  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

1339
1340
1341class IMAP4_stream(IMAP4):
1342
1343 """IMAP4 client class over a stream
1344
1345 Instantiate with: IMAP4_stream(command)
1346
1347 "command" - a string that can be passed to subprocess.Popen()
1348
1349 for more documentation see the docstring of the parent class IMAP4.
1350 """
1351
1352
1353 def __init__(self, command):
1354 self.command = command
1355 IMAP4.__init__(self)
1356
1357
1358 def open(self, host=None, port=None, timeout=None):
1359 """Setup a stream connection.
1360 This connection will be used by the routines:
1361 read, readline, send, shutdown.
1362 """
1363 self.host = None # For compatibility with parent class
1364 self.port = None
1365 self.sock = None
1366 self.file = None
1367 self.process = subprocess.Popen(self.command,
1368 bufsize=DEFAULT_BUFFER_SIZE,
1369 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
1370 shell=True, close_fds=True)
1371 self.writefile = self.process.stdin
1372 self.readfile = self.process.stdout
1373
1374 def read(self, size):
1375 """Read 'size' bytes from remote."""
1376 return self.readfile.read(size)
1377
1378
1379 def readline(self):
1380 """Read line from remote."""
1381 return self.readfile.readline()
1382
1383
1384 def send(self, data):
1385 """Send data to remote."""
1386 self.writefile.write(data)
1387 self.writefile.flush()
1388
1389
1390 def shutdown(self):
1391 """Close I/O established in "open"."""
1392 self.readfile.close()
1393 self.writefile.close()
1394 self.process.wait()
1395
1396
1397

Callers 1

imaplib.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected