Skip to content

Commit

Permalink
[IMPR] Filter does not have to be subclassed
Browse files Browse the repository at this point in the history
Any instance can be passed which has a filter method with the same
semantics:
https://docs.python.org/3/library/logging.html?highlight=logging%20filter#logging.Filter

This also solves an deepsource PY-A6006 issue.

Change-Id: Ic2d3c345725ed33809c484be709f0c3d8b282149
  • Loading branch information
xqt committed Nov 4, 2023
1 parent 35bf9ee commit 76b737a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pywikibot/userinterfaces/terminal_interface_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,12 @@ def emit(self, record) -> None:
self.UI.output(msg, targetStream=self.stream)


class MaxLevelFilter(logging.Filter):
class MaxLevelFilter():

"""Filter that only passes records at or below a specific level.
(setting handler level only passes records at or *above* a specified level,
so this provides the opposite functionality)
.. note:: setting handler level only passes records at or *above* a
specified level, so this provides the opposite functionality.
"""

Expand Down

0 comments on commit 76b737a

Please sign in to comment.