[3.11] Do not use deprecated `logger.warn()` in pyspecific (GH-107694) (#107696)

Do not use deprecated ``logger.warn()`` in pyspecific (GH-107694)
(cherry picked from commit 9564e31cbc)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-08-06 07:06:16 -07:00 committed by GitHub
parent 58b31612e6
commit 2345a8fb0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,7 +185,7 @@ class Availability(SphinxDirective):
if unknown: if unknown:
cls = type(self) cls = type(self)
logger = logging.getLogger(cls.__qualname__) logger = logging.getLogger(cls.__qualname__)
logger.warn( logger.warning(
f"Unknown platform(s) or syntax '{' '.join(sorted(unknown))}' " f"Unknown platform(s) or syntax '{' '.join(sorted(unknown))}' "
f"in '.. availability:: {self.arguments[0]}', see " f"in '.. availability:: {self.arguments[0]}', see "
f"{__file__}:{cls.__qualname__}.known_platforms for a set " f"{__file__}:{cls.__qualname__}.known_platforms for a set "
@ -272,7 +272,7 @@ class AuditEvent(Directive):
info = env.all_audit_events.setdefault(name, new_info) info = env.all_audit_events.setdefault(name, new_info)
if info is not new_info: if info is not new_info:
if not self._do_args_match(info['args'], new_info['args']): if not self._do_args_match(info['args'], new_info['args']):
self.logger.warn( self.logger.warning(
"Mismatched arguments for audit-event {}: {!r} != {!r}" "Mismatched arguments for audit-event {}: {!r} != {!r}"
.format(name, info['args'], new_info['args']) .format(name, info['args'], new_info['args'])
) )
@ -549,7 +549,7 @@ class PydocTopicsBuilder(Builder):
'building topics... ', 'building topics... ',
length=len(pydoc_topic_labels)): length=len(pydoc_topic_labels)):
if label not in self.env.domaindata['std']['labels']: if label not in self.env.domaindata['std']['labels']:
self.env.logger.warn('label %r not in documentation' % label) self.env.logger.warning(f'label {label!r} not in documentation')
continue continue
docname, labelid, sectname = self.env.domaindata['std']['labels'][label] docname, labelid, sectname = self.env.domaindata['std']['labels'][label]
doctree = self.env.get_and_resolve_doctree(docname, self) doctree = self.env.get_and_resolve_doctree(docname, self)