Skip to content

logging.Logger.addFilter #5700

@Akuli

Description

@Akuli
porcupine/plugins/langserver.py:789: error: Argument 1 to "addFilter" of "Filterer" has incompatible type "HackFilter"; expected "Union[Filter, Callable[[LogRecord], int]]"

HackFilter is a class that has a filter() method but doesn't inherit from anything. This should work, according to docs: "You don’t actually need to subclass Filter: you can pass any instance which has a filter method with the same semantics." https://docs.python.org/3/library/logging.html

Callable[[LogRecord], int] seems wrong. The imlpementation basically does self.filters.append(filter). Does it really handle callables and objects with a .filter() method everywhere where it uses self.filters?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions