We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e4103f + d560e38 commit 9a0cad2Copy full SHA for 9a0cad2
pyupgrade/_plugins/shlex_join.py
@@ -39,7 +39,7 @@ def visit_Call(
39
if (
40
isinstance(node.func, ast.Attribute) and
41
isinstance(node.func.value, ast.Constant) and
42
- isinstance(node.func.value.value, str) and
+ node.func.value.value == ' ' and
43
node.func.attr == 'join' and
44
not node.keywords and
45
len(node.args) == 1 and
tests/features/shlex_join_test.py
@@ -15,6 +15,12 @@
15
(3, 8),
16
id='quote from-imported',
17
),
18
+ pytest.param(
19
+ 'import shlex\n'
20
+ '"wat".join(shlex.quote(arg) for arg in cmd)\n',
21
+ (3, 8),
22
+ id='not joined with space',
23
+ ),
24
pytest.param(
25
'import shlex\n'
26
'" ".join(shlex.quote(arg) for arg in cmd)\n',
0 commit comments