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

Method _base_init

tools/python-3.11.9-amd64/Lib/nntplib.py:350–382  ·  view source on GitHub ↗

Partial initialization for the NNTP protocol. This instance method is extracted for supporting the test code.

(self, readermode)

Source from the content-addressed store, hash-verified

348 raise
349
350 def _base_init(self, readermode):
351 """Partial initialization for the NNTP protocol.
352 This instance method is extracted for supporting the test code.
353 """
354 self.debugging = 0
355 self.welcome = self._getresp()
356
357 # Inquire about capabilities (RFC 3977).
358 self._caps = None
359 self.getcapabilities()
360
361 # 'MODE READER' is sometimes necessary to enable 'reader' mode.
362 # However, the order in which 'MODE READER' and 'AUTHINFO' need to
363 # arrive differs between some NNTP servers. If _setreadermode() fails
364 # with an authorization failed error, it will set this to True;
365 # the login() routine will interpret that as a request to try again
366 # after performing its normal function.
367 # Enable only if we're not already in READER mode anyway.
368 self.readermode_afterauth = False
369 if readermode and 'READER' not in self._caps:
370 self._setreadermode()
371 if not self.readermode_afterauth:
372 # Capabilities might have changed after MODE READER
373 self._caps = None
374 self.getcapabilities()
375
376 # RFC 4642 2.2.2: Both the client and the server MUST know if there is
377 # a TLS session active. A client MUST NOT attempt to start a TLS
378 # session if a TLS session is already active.
379 self.tls_on = False
380
381 # Log in and encryption setup order is left to subclasses.
382 self.authenticated = False
383
384 def __enter__(self):
385 return self

Callers 1

__init__Method · 0.95

Calls 3

_getrespMethod · 0.95
getcapabilitiesMethod · 0.95
_setreadermodeMethod · 0.95

Tested by

no test coverage detected