Skip to content

Commit 985b383

Browse files
authored
Fix bug with double quotes; change "--quiet" default (#236)
1 parent e4fc6cd commit 985b383

File tree

7 files changed

+57
-8
lines changed

7 files changed

+57
-8
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log
22

3+
## [0.6.6] - 2025-04-16
4+
5+
- Fixed
6+
- A bug where double quotes in function signature type hints are not treated
7+
as interchangeable as double quotes in the docstring
8+
- Changed
9+
- Changed the default of option `--quiet` from False to True
10+
- Full diff
11+
- https://github.com/jsh9/pydoclint/compare/0.6.5...0.6.6
12+
313
## [0.6.5] - 2025-04-03
414

515
- Fixed

pydoclint/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def validateStyleValue(
4949
'-q',
5050
'--quiet',
5151
is_flag=True,
52-
default=False,
52+
default=True,
5353
help='If True, do not print the file names being checked to the terminal.',
5454
)
5555
@click.option(

pydoclint/utils/arg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from docstring_parser.common import DocstringAttr, DocstringParam
77

88
from pydoclint.utils.edge_case_error import EdgeCaseError
9-
from pydoclint.utils.generic import stripQuotes
9+
from pydoclint.utils.generic import specialEqual, stripQuotes
1010
from pydoclint.utils.unparser_custom import unparseName
1111

1212

@@ -129,7 +129,7 @@ def _typeHintsEq(cls, hint1: str, hint2: str) -> bool:
129129
except SyntaxError:
130130
hint2_ = hint2
131131

132-
return hint1_ == hint2_
132+
return specialEqual(hint1_, hint2_)
133133

134134
@classmethod
135135
def _removeEscapeChar(cls, string: str) -> str:

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pydoclint
3-
version = 0.6.5
3+
version = 0.6.6
44
description = A Python docstring linter that checks arguments, returns, yields, and raises sections
55
long_description = file: README.md
66
long_description_content_type = text/markdown

tests/data/edge_cases/09_double_quotes_in_Literal/google.py renamed to tests/data/edge_cases/09_double_quotes/google.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# fmt: off
22

3-
# This edge case comes from https://github.com/jsh9/pydoclint/issues/105
3+
# The edge cases comes from:
4+
# https://github.com/jsh9/pydoclint/issues/105
5+
# https://github.com/jsh9/pydoclint/issues/231
46

57
from __future__ import annotations
68

@@ -44,3 +46,18 @@ def func_3(arg1: Literal['foo']) -> tuple[Literal['foo'], Literal["bar"]]:
4446
tuple[Literal['foo'], Literal["bar"]]: The literal strings 'foo' & "bar"
4547
"""
4648
return 'foo', "bar"
49+
50+
51+
async def upload_tickets(
52+
file: Annotated[UploadFile, File(description="Excel file with tickets")],
53+
) -> dict:
54+
"""
55+
Upload and process tickets from an Excel file.
56+
57+
Args:
58+
file (Annotated[UploadFile, File(description="Excel file with tickets")]): The file
59+
60+
Returns:
61+
dict: Processed ticket data.
62+
"""
63+
pass

tests/data/edge_cases/09_double_quotes_in_Literal/numpy.py renamed to tests/data/edge_cases/09_double_quotes/numpy.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# fmt: off
22

3-
# This edge case comes from https://github.com/jsh9/pydoclint/issues/105
3+
# The edge cases comes from:
4+
# https://github.com/jsh9/pydoclint/issues/105
5+
# https://github.com/jsh9/pydoclint/issues/231
6+
47

58
from __future__ import annotations
69

@@ -55,3 +58,22 @@ def func_3() -> tuple[Literal['foo'], Literal["bar"]]:
5558
the function signature.
5659
"""
5760
return "foo", 'bar'
61+
62+
63+
async def upload_tickets(
64+
file: Annotated[UploadFile, File(description="Excel file with tickets")],
65+
) -> dict:
66+
"""
67+
Upload and process tickets from an Excel file.
68+
69+
Parameters
70+
----------
71+
file : Annotated[UploadFile, File(description="Excel file with tickets")]
72+
The uploaded Excel file containing ticket data.
73+
74+
Returns
75+
-------
76+
dict
77+
Processed ticket data.
78+
"""
79+
pass

tests/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ def testNonAscii() -> None:
14611461
],
14621462
),
14631463
('08_return_section_parsing/google.py', {'style': 'google'}, []),
1464-
('09_double_quotes_in_Literal/google.py', {'style': 'google'}, []),
1465-
('09_double_quotes_in_Literal/numpy.py', {'style': 'numpy'}, []),
1464+
('09_double_quotes/google.py', {'style': 'google'}, []),
1465+
('09_double_quotes/numpy.py', {'style': 'numpy'}, []),
14661466
(
14671467
'10_absent_return_anno/numpy.py',
14681468
{'style': 'numpy'},

0 commit comments

Comments
 (0)