MCPcopy Index your code
hub / github.com/python/cpython / _getline

Method _getline

Lib/poplib.py:134–149  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

132 # Raise error_proto('-ERR EOF') if the connection is closed.
133
134 def _getline(self):
135 line = self.file.readline(_MAXLINE + 1)
136 if len(line) > _MAXLINE:
137 raise error_proto('line too long')
138
139 if self._debugging > 1: print('*get*', repr(line))
140 if not line: raise error_proto('-ERR EOF')
141 octets = len(line)
142 # server can send any combination of CR & LF
143 # however, 'readline()' returns lines ending in LF
144 # so only possibilities are ...LF, ...CRLF, CR...LF
145 if line[-2:] == CRLF:
146 return line[:-2], octets
147 if line[:1] == CR:
148 return line[1:-1], octets
149 return line[:-1], octets
150
151
152 # Internal: get a response from the server.

Callers 2

_getrespMethod · 0.95
_getlongrespMethod · 0.95

Calls 2

error_protoClass · 0.70
readlineMethod · 0.45

Tested by

no test coverage detected