Hello Jean,
Glad to see your still playing along.
I have tested your script and it is broken too :(
Good idea about checking for the ':' , it just doesn't cover every
case.
This is the very reason I had not included docstring support before!
The problem is more diffcult than it first appears,
I am
Attached is another version of the stripper.py file. It contains my
change which seem to handle docstring correctly (at least on itself).
/Jean Brouwers
##
# Python source stripper / cleaner ;)
###
I found the bug and hope I have squashed it.
Single and qouble quoted strings that were assignments and spanned
multilines using \ , were chopped after the first line.
example:
__date__ = 'Apr 16, 2005,' \
'Jan 15 2005,' \
'Oct 24 2004'
became:
__date__ = 'Apr 16, 2005,' \
Google has now 'fixed' there whitespace issue and now has an auto-quote
issue argggh!
The script is located at:
http://bellsouthpwp.net/m/e/mefjr75/python/stripper.py
M.E.Farmer
--
http://mail.python.org/mailman/listinfo/python-list
MrJean1 wrote:
> There is an issue with both my and your code: it only works if doc
> strings are triple quoted and if there are no other triple quoted
> strings in the Python code.
I had not considered single quoted strings ;)
> A triple quoted string used in an assignment will be removed, for
> e
There is an issue with both my and your code: it only works if doc
strings are triple quoted and if there are no other triple quoted
strings in the Python code.
A triple quoted string used in an assignment will be removed, for
example this case
s = '''this string should not be removed'''
It
Thanks Jean,
I have thought about adding docstrings several times, but I was stumped
at how to determine a docstring from a regular tripleqoted string ;)
I have been thinking hard about the problem and I think I have an idea.
If the line has nothing before the start of the string it must be a
docst
Hi,
Importing a text file from another o.s. is not a problem : I convert
it immediately using the powerful shell functions of Linux (and Unix).
I thank you for the explanation about classes, but I am rather dumb
and
by now I resolved all my problems without them...
Speaking of problems..., I have
Great tool, indeed! But doc strings stay in the source text.
If you do need to remove doc strings as well, add the following into
the __call__ method.
... # kill doc strings
... if not self.docstrings:
... if toktype == tokenize.STRING and len(toktext) >= 6:
...
Glad you are making progress ;)
>I give you a brief example of the xref output (taken from your >code,
>also if the line numbers don't match, because I modified >your code,
>not beeing interested in eof's other than Linux).
What happens when you try to analyze a script from a diffrent os ? It
usu
Hi,
At last I succeded in implementing a cross reference tool!
(with your help and that of other gurus...).
Now I can face the problem (for me...) of understanding your
code (I have not grasped the classes and objects...).
I give you a brief example of the xref output (taken from your code,
also
Hi,
I have no more need to corret my code's bugs and send to clp group a
working application (I don't think that there was an eager
expectation...).
Your code is perfectly working (as you can expect from a guru...).
Thank you and bye.
--
http://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo