Release v2.6.0
Changelog
[v2.6.0]
Added
- #98 Add
--dispatch-decorators
to support suppression of all errors from functions decorated by decorators such asfunctools.singledispatch
andfunctools.singledispatchmethod
. - #99 Add
--overload-decorators
to support generic aliasing of thetyping.overload
decorator.
Fixed
- #106 Fix incorrect parsing of multiline docstrings with less than two lines of content, causing incorrect line numbers for yielded errors in Python versions prior to 3.8
Additional Details
Generic Functions
Per #98, the functools.singledispatch
and functools.singledispatchmethod
decorators transform a function into a single-dispatch generic function.
For example:
import functools
@functools.singledispatch
def foo(a):
print(a)
@foo.register
def _(a: list) -> None:
for idx, thing in enumerate(a):
print(idx, thing)
Is correctly annotated but would previously yield linting errors for foo
. In the spirit of the purpose of these decorators, linting errors are now suppressed for functions decorated with these decorators. The --dispatch-decorators
configuration option has been added, which specifies a comma-separated list of decorators to be considered as dispatch decorators.
Decorators are matched based on their attribute name. For example, "singledispatch"
will match any of the following:
import functools; @functools.singledispatch
import functools as fnctls; @fnctls.singledispatch
from functools import singledispatch; @singledispatch
By default, linting errors are suppressed for functions decorated by singledispatch
or singledispatchmethod
.
typing.overload
decorator aliasing
Per #99, handling of the typing.overload
has been made generic, removing the caveat from the initial implementation. The --overload-decorators
configuration option has been added, which specifies a comma-separated list of decorators to be considered as typing.overload
decorators.
Decorators are now matched based on their attribute name. For example, "overload"
will match any of the following:
import typing; @typing.overload
import typing as t; @t.overload
from typing import overload; @overload
By default, linting errors are suppressed for functions decorated by overload
, which should be a transparent change from v2.4 (#97).