#8680: untabify Sage again, and make it stick
------------------------------+---------------------------------------------
Reporter: jhpalmieri | Owner: jason
Type: enhancement | Status: positive_review
Priority: major | Milestone: sage-4.5
Component: doctest | Keywords:
Author: John Palmieri | Upstream: N/A
Reviewer: David Loeffler | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Comment(by jhpalmieri):
> it's IMHO undesirable to slow down every doctesting by scanning each
file twice in addition.
I just wrote a function like this:
{{{
def search_for_tabs(file):
# search for tabs. if found, the doctest fails, unless the string
# "SAGE_DOCTEST_ALLOW_TABS" is also present somewhere in the file.
import os
ext = os.path.splitext(file)[1]
if ext in [".py", ".pyx", ".sage", ".spyx"]:
ff = open(file)
source = ff.read()
ff.close()
if (source.find("SAGE_DOCTEST_ALLOW_TABS") == -1
and source.find("\t") != -1):
numfail += 1
s = "*"*70 + "\n" + "Error: TAB character found.\n" + s
}}}
If I run it on sage/combinat/sloane_functions.py, which is pretty big for
a Sage library file (241510 bytes), running inside Sage and using
"timeit", it takes 400-500 microseconds. For the roughly 2500 files in
the Sage library, this adds between 1 and 2 seconds, total. Some timings
for the "homology" directory: with the old version of sage-doctest: 49.2
and 48.8 seconds. With the new version: 49.5 and 48.9 seconds. In other
words, the variation in these timings due to whatever else is going on
with the computer are larger than the differences in timing due to the
changes in sage-doctest from this ticket.
I would propose including this now, since it shouldn't slow things down
much and it will keep more tabs from creeping into the Sage library, and
then modifying it later if you want.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8680#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.