Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot correct indentation of this function #36

Closed
leoliu opened this issue Jul 24, 2012 · 7 comments
Closed

Cannot correct indentation of this function #36

leoliu opened this issue Jul 24, 2012 · 7 comments

Comments

@leoliu
Copy link

leoliu commented Jul 24, 2012

Try autopep8 on this function:

def long_function_name(
    var_one, var_two, var_three,
    var_four):
    print(var_one)

and it suggests:

def long_function_name(
    var_one, var_two, var_three,
        var_four):
    print(var_one)
@myint
Copy link
Collaborator

myint commented Jul 24, 2012

The correct indentation (to distinguish the parameters from the function body), would be:

def long_function_name(
        var_one, var_two, var_three,
        var_four):
    print(var_one)

The reason we end up with current output is due to pep8. It doesn't complain about the output you are getting.

@myint
Copy link
Collaborator

myint commented Jul 24, 2012

By the way, I added this to the pep8 issue list.

@leoliu
Copy link
Author

leoliu commented Jul 25, 2012

Thank you for looking into this.

@myint
Copy link
Collaborator

myint commented Jul 27, 2012

See the issue on pep8's issue list.

@smichr
Copy link

smichr commented Oct 18, 2012

Is this only indenting the 2nd continued line for the same reason?

$ pep8 --version
1.3.3
$ ../autopep8/autopep8.py --version
autopep8: 0.8.1
$ ../autopep8/autopep8.py -r --select=E122 --diff sympy/solvers/ode.py
--- original/sympy/solvers/ode.py
+++ fixed/sympy/solvers/ode.py
@@ -1533,7 +1533,7 @@
                     for o in other:
                         b, e = o.as_base_exp()
                         if b.is_Add and \
-                        all(a.args_cnc(cset=True, warn=False)[0] & \
+                            all(a.args_cnc(cset=True, warn=False)[0] & \
                         con_set for a in b.args):
                             expr = sign(Mul(*num))*Mul._from_args(other)
                             break

@myint
Copy link
Collaborator

myint commented Oct 18, 2012

No, I think the culprit is --select=E122. If you want to only fix alignment issues, try --select=E12.

@myint
Copy link
Collaborator

myint commented Oct 25, 2012

I'm going to close this since we are doing to correct thing given pep8's output. If pep8 eventually changes to mark this case as incorrect, then autopep8 will automatically fix it.

@myint myint closed this as completed Oct 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants