Subject: [Ufl] Fwd: [Branch ~ufl-core/ufl/main] Rev 1192: Fix indentation bug introduced in last commit.

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 20 Sep 2011 11:13:49 +0100

Related to indentation, I opened some UFL code recently and it had tab
characters. This screwed up the indentation, and as presented on my
screen made it ambiguous as to what the code should/would do. Is there
an easy way to search files for tab characters so we can then remove
them?

Garth

---------- Forwarded message ----------
From:  <[email-masked]>
Date: 20 September 2011 10:56
Subject: [Branch ~ufl-core/ufl/main] Rev 1192: Fix indentation bug
introduced in last commit.
To: Garth Wells <[email-masked]>

------------------------------------------------------------
revno: 1192
committer: Martin Sandve Alnæs <[email-masked]>
branch nick: work
timestamp: Tue 2011-09-20 11:51:54 +0200
message:
 Fix indentation bug introduced in last commit.
modified:
 ufl/operators.py

--
lp:ufl
https://code.launchpad.net/~ufl-core/ufl/main

Your team UFL Core Team is subscribed to branch lp:ufl.
To unsubscribe from this branch go to
https://code.launchpad.net/~ufl-core/ufl/main/+edit-subscription

=== modified file 'ufl/operators.py'
--- ufl/operators.py    2011-09-20 09:35:48 +0000
+++ ufl/operators.py    2011-09-20 09:51:54 +0000
@@ -238,7 +238,7 @@
            ii = indices(r + 1)
            if r:
                f = f[ii[:-1]]
-                df = f.dx(ii[-1])
+            df = f.dx(ii[-1])
            return as_tensor(df, ii)

    return VariableDerivative(f, v)
=== modified file 'ufl/operators.py'
--- ufl/operators.py	2011-09-20 09:35:48 +0000
+++ ufl/operators.py	2011-09-20 09:51:54 +0000
@@ -238,7 +238,7 @@
             ii = indices(r + 1)
             if r:
                 f = f[ii[:-1]]
-                df = f.dx(ii[-1])
+            df = f.dx(ii[-1])
             return as_tensor(df, ii)
 
     return VariableDerivative(f, v)

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 20 Sep 2011 12:23:04 +0200

Ouch. I hate that. I'll see if I can find and fix.

Martin

On 20 September 2011 12:13, Garth N. Wells <[email-masked]> wrote:
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>
>

---

From: Johannes Ring <[email-masked]>
Date: Tue, 20 Sep 2011 12:23:21 +0200

> an easy way to search files for tab characters so we can then remove

Something like this should work:

  $ sed -i 's/\t/    /g' tab-file.txt

Johannes

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 20 Sep 2011 12:31:35 +0200

>  $ sed -i 's/\t/    /g' tab-file.txt

Yes and no. This is not a safe way to do it because tabs may be
intended to be 8 spaces wide, and that is precisely why it is so
dangerous to mix spaces and tabs... I think Python is too liberal when
allowing that. But
  sed -i 's/\t/    /g' *.py
  bzr diff
allows you to see the extent of the problem. Then I fixed it manually,
just a few lines.

Martin

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 20 Sep 2011 11:32:40 +0100

>  $ sed -i 's/\t/    /g' tab-file.txt

Maybe we could add a check for tabs to the test scripts?

Garth