From 9788857df69b0d616a1e4c0f8be1a845cc279e3d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 7 Aug 2019 15:57:06 -0400 Subject: [PATCH] Turn the comment into a docstring --- misc/build_helpers/run-deprecations.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/misc/build_helpers/run-deprecations.py b/misc/build_helpers/run-deprecations.py index 1c7b10c4b..3972d5c89 100644 --- a/misc/build_helpers/run-deprecations.py +++ b/misc/build_helpers/run-deprecations.py @@ -37,13 +37,21 @@ class RunPP(protocol.ProcessProtocol): def make_matcher(options): - # A deprecation warning line looks something like this: - # - # somepath/foo/bar/baz.py:43: DeprecationWarning: Foo is deprecated, try bar instead. - # - # Sadly there is no guarantee warnings begin at the beginning of a line - # since they are written to output without coordination with whatever - # other Python code is running in the process. + """ + Make a function that matches a line with a relevant deprecation. + + A deprecation warning line looks something like this:: + + somepath/foo/bar/baz.py:43: DeprecationWarning: Foo is deprecated, try bar instead. + + Sadly there is no guarantee warnings begin at the beginning of a line + since they are written to output without coordination with whatever other + Python code is running in the process. + + :return: A one-argument callable that accepts a string and returns + ``True`` if it contains an interesting warning and ``False`` + otherwise. + """ pattern = r".*\.py[oc]?:\d+:" # (Pending)?DeprecationWarning: .*" if options["package"]: pattern = r".*/{}/".format(