bpo-37390: Add audit event table to documentations (GH-14406)


Also updates some (unreleased) event names to be consistent with the others.
(cherry picked from commit 44f91c388a6f4da9ed3300df32ca290b8aa104ea)

Co-authored-by: Steve Dower <steve.dower@python.org>
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 27bf6da..58a46bc 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -148,7 +148,7 @@
             self.timeout = timeout
         if source_address is not None:
             self.source_address = source_address
-        sys.audit("ftplib.FTP.connect", self, self.host, self.port)
+        sys.audit("ftplib.connect", self, self.host, self.port)
         self.sock = socket.create_connection((self.host, self.port), self.timeout,
                                              source_address=self.source_address)
         self.af = self.sock.family
@@ -189,7 +189,7 @@
     def putline(self, line):
         if '\r' in line or '\n' in line:
             raise ValueError('an illegal newline character should not be contained')
-        sys.audit("ftplib.FTP.sendcmd", self, line)
+        sys.audit("ftplib.sendcmd", self, line)
         line = line + CRLF
         if self.debugging > 1:
             print('*put*', self.sanitize(line))
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index face45b..822d9d6 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -289,7 +289,7 @@
         # (which is used by socket.create_connection()) expects None
         # as a default value for host.
         host = None if not self.host else self.host
-        sys.audit("imaplib.IMAP4.open", self, self.host, self.port)
+        sys.audit("imaplib.open", self, self.host, self.port)
         return socket.create_connection((host, self.port))
 
     def open(self, host = '', port = IMAP4_PORT):
@@ -319,7 +319,7 @@
 
     def send(self, data):
         """Send data to remote."""
-        sys.audit("imaplib.IMAP4.send", self, data)
+        sys.audit("imaplib.send", self, data)
         self.sock.sendall(data)
 
 
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index e7bbc85..1b7e83a 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -414,7 +414,7 @@
     def _putline(self, line):
         """Internal: send one line to the server, appending CRLF.
         The `line` must be a bytes-like object."""
-        sys.audit("nntplib.NNTP.putline", self, line)
+        sys.audit("nntplib.putline", self, line)
         line = line + _CRLF
         if self.debugging > 1: print('*put*', repr(line))
         self.file.write(line)
@@ -1042,7 +1042,7 @@
         """
         self.host = host
         self.port = port
-        sys.audit("nntplib.NNTP", self, host, port)
+        sys.audit("nntplib.connect", self, host, port)
         self.sock = socket.create_connection((host, port), timeout)
         file = None
         try:
@@ -1074,7 +1074,7 @@
             """This works identically to NNTP.__init__, except for the change
             in default port and the `ssl_context` argument for SSL connections.
             """
-            sys.audit("nntplib.NNTP", self, host, port)
+            sys.audit("nntplib.connect", self, host, port)
             self.sock = socket.create_connection((host, port), timeout)
             file = None
             try:
diff --git a/Lib/poplib.py b/Lib/poplib.py
index ced0a2d..e3bd2ab 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -100,7 +100,7 @@
         self.host = host
         self.port = port
         self._tls_established = False
-        sys.audit("poplib.POP3", self, host, port)
+        sys.audit("poplib.connect", self, host, port)
         self.sock = self._create_socket(timeout)
         self.file = self.sock.makefile('rb')
         self._debugging = 0
@@ -111,7 +111,7 @@
 
     def _putline(self, line):
         if self._debugging > 1: print('*put*', repr(line))
-        sys.audit("poplib.POP3.putline", self, line)
+        sys.audit("poplib.putline", self, line)
         self.sock.sendall(line + CRLF)
 
 
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 01f3d43..a634f7a 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -335,7 +335,7 @@
             port = self.default_port
         if self.debuglevel > 0:
             self._print_debug('connect:', (host, port))
-        sys.audit("smtplib.SMTP.connect", self, host, port)
+        sys.audit("smtplib.connect", self, host, port)
         self.sock = self._get_socket(host, port, self.timeout)
         self.file = None
         (code, msg) = self.getreply()
@@ -353,7 +353,7 @@
                 # should not be used, but 'data' needs to convert the string to
                 # binary itself anyway, so that's not a problem.
                 s = s.encode(self.command_encoding)
-            sys.audit("smtplib.SMTP.send", self, s)
+            sys.audit("smtplib.send", self, s)
             try:
                 self.sock.sendall(s)
             except OSError: