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

Method found_terminator

Lib/test/support/smtpd.py:324–383  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

322
323 # Implementation of base class abstract method
324 def found_terminator(self):
325 line = self._emptystring.join(self.received_lines)
326 print('Data:', repr(line), file=DEBUGSTREAM)
327 self.received_lines = []
328 if self.smtp_state == self.COMMAND:
329 sz, self.num_bytes = self.num_bytes, 0
330 if not line:
331 self.push('500 Error: bad syntax')
332 return
333 if not self._decode_data:
334 line = str(line, 'utf-8')
335 i = line.find(' ')
336 if i < 0:
337 command = line.upper()
338 arg = None
339 else:
340 command = line[:i].upper()
341 arg = line[i+1:].strip()
342 max_sz = (self.command_size_limits[command]
343 if self.extended_smtp else self.command_size_limit)
344 if sz > max_sz:
345 self.push('500 Error: line too long')
346 return
347 method = getattr(self, 'smtp_' + command, None)
348 if not method:
349 self.push('500 Error: command "%s" not recognized' % command)
350 return
351 method(arg)
352 return
353 else:
354 if self.smtp_state != self.DATA:
355 self.push('451 Internal confusion')
356 self.num_bytes = 0
357 return
358 if self.data_size_limit and self.num_bytes > self.data_size_limit:
359 self.push('552 Error: Too much mail data')
360 self.num_bytes = 0
361 return
362 # Remove extraneous carriage returns and de-transparency according
363 # to RFC 5321, Section 4.5.2.
364 data = []
365 for text in line.split(self._linesep):
366 if text and text[0] == self._dotsep:
367 data.append(text[1:])
368 else:
369 data.append(text)
370 self.received_data = self._newline.join(data)
371 args = (self.peer, self.mailfrom, self.rcpttos, self.received_data)
372 kwargs = {}
373 if not self._decode_data:
374 kwargs = {
375 'mail_options': self.mail_options,
376 'rcpt_options': self.rcpt_options,
377 }
378 status = self.smtp_server.process_message(*args, **kwargs)
379 self._set_post_data_state()
380 if not status:
381 self.push('250 OK')

Callers

nothing calls this directly

Calls 14

pushMethod · 0.95
_set_post_data_stateMethod · 0.95
reprFunction · 0.85
strFunction · 0.85
getattrFunction · 0.85
methodFunction · 0.85
printFunction · 0.50
joinMethod · 0.45
findMethod · 0.45
upperMethod · 0.45
stripMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected