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

Preventing the D103 error when the function is decorated with @overload. #511

Merged
merged 17 commits into from
Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added an is_overload method in the function class(parser.py).
Added an if statement so that the D103 error will not trigger when decorated with @overload(checker.py)

Added some tests to see that it's working correctly.
  • Loading branch information
theyuvalraz committed Sep 5, 2020
commit d033b85a51bf86f44090af4618b4c1a0b7c91af9
1 change: 0 additions & 1 deletion src/pydocstyle/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ast
import string
import sys
import textwrap
import tokenize as tk
from itertools import takewhile, chain
from re import compile as re
Expand Down
8 changes: 4 additions & 4 deletions src/tests/test_cases/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def nested():


@overload
def overloaded_func(a: str) -> str:
def overloaded_func(a: int) -> str:
return 2


@expect('D103: Missing docstring in public function', arg_count=1)
def overloaded_func(a):
return str(a)
@overload
def overloaded_func(a: str) -> str:
return '1'


def overloaded_func(a):
Expand Down