Lines Matching refs:line
17 Here 'resp' is the server response line.
91 # maximal line length when calling readline(). This is to prevent
92 # reading arbitrary length lines. RFC 3977 limits NNTP line length to
137 '211', # LISTGROUP (also not multi-line with GROUP)
187 for line in lines:
188 if line[0] == ':':
190 name, _, suffix = line[1:].partition(':')
194 name, _, suffix = line.partition(':')
211 for line in lines:
213 article_number, *tokens = line.split('\t')
303 # However, some multi-line data blocks can contain arbitrary bytes (for
444 def _putline(self, line):
445 """Internal: send one line to the server, appending CRLF.
446 The `line` must be a bytes-like object."""
447 sys.audit("nntplib.putline", self, line)
448 line = line + _CRLF
449 if self.debugging > 1: print('*put*', repr(line))
450 self.file.write(line)
453 def _putcmd(self, line):
455 The `line` must be a unicode string."""
456 if self.debugging: print('*cmd*', repr(line))
457 line = line.encode(self.encoding, self.errors)
458 self._putline(line)
461 """Internal: return one line from the server, stripping _CRLF.
464 line = self.file.readline(_MAXLINE +1)
465 if len(line) > _MAXLINE:
466 raise NNTPDataError('line too long')
468 print('*get*', repr(line))
469 if not line: raise EOFError
471 if line[-2:] == _CRLF:
472 line = line[:-2]
473 elif line[-1:] in _CRLF:
474 line = line[:-1]
475 return line
517 line = self._getline(False)
518 if line in terminators:
520 if line.startswith(b'..'):
521 line = line[1:]
522 file.write(line)
526 line = self._getline()
527 if line == terminator:
529 if line.startswith(b'..'):
530 line = line[1:]
531 lines.append(line)
539 def _shortcmd(self, line):
542 self._putcmd(line)
545 def _longcmd(self, line, file=None):
548 self._putcmd(line)
551 def _longcmdstring(self, line, file=None):
556 self._putcmd(line)
558 return resp, [line.decode(self.encoding, self.errors)
559 for line in list]
580 return [GroupInfo(*line.split()) for line in lines]
591 for line in lines:
592 name, *tokens = line.split()
720 """Internal: parse the response line of a STAT, NEXT, LAST,
729 def _statcmd(self, line):
731 resp = self._shortcmd(line)
756 def _artcmd(self, line, file=None):
758 resp, lines = self._longcmd(line, file)
821 def remove_number(line):
822 m = pat.match(line)
823 return m.group(1, 2) if m else line
824 return resp, [remove_number(line) for line in lines]
894 # - we don't want a spurious flush() after each line is written
895 for line in f:
896 if not line.endswith(_CRLF):
897 line = line.rstrip(b"\r\n") + _CRLF
898 if line.startswith(b'.'):
899 line = b'.' + line
900 self.file.write(line)