Skip to content

Commit 50b0a35

Browse files
committed
Properly escape backslash; remove redundant noqa LN002
1 parent 15818da commit 50b0a35

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pydoclint/utils/return_anno.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ def decompose(self) -> list[str]:
5858
parsedBody0: ast.Expr = ast.parse(insideTuple).body[0] # type:ignore[assignment] # noqa: LN002
5959
if isinstance(
6060
parsedBody0.value, (ast.Attribute, ast.Name)
61-
): # such as Tuple[int] # noqa: LN002
61+
): # such as Tuple[int]
6262
return [insideTuple]
6363

6464
if isinstance(
6565
parsedBody0.value, ast.Tuple
66-
): # like Tuple[int, str] # noqa: LN002
66+
): # like Tuple[int, str]
6767
elts: list[ast.expr] = parsedBody0.value.elts
6868
return [unparseName(_) for _ in elts] # type:ignore[misc]
6969

tests/utils/test_arg.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def testArg_initializationCheck():
1616
(Arg(name='1', typeHint='2'), '1: 2'),
1717
(Arg(name='arg1', typeHint='str'), 'arg1: str'),
1818
(Arg(name='obj', typeHint='int | float'), 'obj: int | float'),
19-
(Arg(name='arg1\_\_', typeHint='Any'), 'arg1__: Any'), # noqa: W605
19+
(Arg(name='arg1\\_\\_', typeHint='Any'), 'arg1__: Any'), # noqa: W605
2020
(Arg(name='**kwargs', typeHint='Any'), '**kwargs: Any'),
2121
(Arg(name='\\**kwargs', typeHint='Any'), '**kwargs: Any'),
2222
],
@@ -211,8 +211,8 @@ def testArgList_length(input_: ArgList, expected: int) -> None:
211211
ArgList([Arg('\\*args', '1'), Arg('**kwargs', '2')]),
212212
),
213213
(
214-
ArgList([Arg('arg1\_', '1'), Arg('arg2__', '2')]), # noqa: W605
215-
ArgList([Arg('arg1_', '1'), Arg('arg2\_\_', '2')]), # noqa: W605
214+
ArgList([Arg('arg1\\_', '1'), Arg('arg2__', '2')]), # noqa: W605
215+
ArgList([Arg('arg1_', '1'), Arg('arg2\\_\\_', '2')]), # noqa: W605
216216
),
217217
],
218218
)
@@ -325,8 +325,8 @@ def testArgList_contains(
325325
{Arg('**kwargs', '2')},
326326
),
327327
(
328-
ArgList([Arg('arg1\_', '1'), Arg('arg2__', '2')]), # noqa: W605
329-
ArgList([Arg('arg2\_\_', '2')]), # noqa: W605
328+
ArgList([Arg('arg1\\_', '1'), Arg('arg2__', '2')]), # noqa: W605
329+
ArgList([Arg('arg2\\_\\_', '2')]), # noqa: W605
330330
{Arg('arg1_', '1')},
331331
),
332332
],

0 commit comments

Comments
 (0)