Closed tomsib2001 closed 1 year ago
Are you saying that running code with a function defined as
def f(x_: str):
return x_
procude that error? Or is the actual formatting of the function argument causing the error? Cause I have no issues running a script with this syntax (on 3.10.8 though).
I can't reproduce it specifically in my environment.
$ python3 --version
Python 3.10.6
$ autopep8 --version
autopep8 2.0.0 (pycodestyle: 2.10.0)
$ cat ff.py
def f(x_ : str):
return x_
$ autopep8 -d ff.py
--- original/ff.py
+++ fixed/ff.py
@@ -1,2 +1,2 @@
-def f(x_ : str):
+def f(x_: str):
return x_
$ autopep8 -i ff.py
$ python ff.py
$
Is it possible that file.py is importing another file and a syntax error is occurring there? In any case, it is not autopep8's problem for now, so I'll close it. If you have additional information, I would appreciate your comments.
@tomsib2001
x_ : str
in a function argument gets reformatted asx_: str
which then triggers a runtime errorSyntaxError: invalid syntax
Python Code
Command Line and Configuration
No specific configuration
.pep8
,setup.cfg
, ...Command Line
Your Environment