Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fix issues with typing.overload #571

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/pydocstyle/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,21 @@ def check_docstring_missing(self, definition, docstring):

"""
if not docstring and definition.is_public:

def method_violations():
if not definition.is_overload:
if definition.is_magic:
return violations.D105()
if definition.is_init:
return violations.D107()
return violations.D102()
return None

codes = {
Module: violations.D100,
Class: violations.D101,
NestedClass: violations.D106,
Method: lambda: violations.D105()
if definition.is_magic
else (
violations.D107()
if definition.is_init
else (
violations.D102()
if not definition.is_overload
else None
)
),
Method: method_violations,
NestedFunction: violations.D103,
Function: (
lambda: violations.D103()
Expand Down
3 changes: 2 additions & 1 deletion src/pydocstyle/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def is_public(self):
def is_overload(self):
"""Return True iff the method decorated with overload."""
return any(
decorator.name == "overload" for decorator in self.decorators
decorator.name in ["overload", "typing.overload"]
for decorator in self.decorators
)

def is_property(self, property_decorator_names):
Expand Down