Python Reverse engineering fails

Python Reverse engineering fails on yield statements

Hi Rheniser,

Thanks for your post. I noticed that you have another post with the same questions at http://forums.visual-paradigm.com/posts/list/5689.html
We’ll continue discussing this issue in your another post.

Best regards,
Lilian Wong

They are separate posts. Your software fails to recognize in python:

  1. the yield command
  2. the from command

I’m evaluating VP UML Case Tools for large scale python software development. With these two issues unresolved we will most likely pass.

Thanks,
Ryan

Hi Rheniser,

Thanks for your reply and I’m sorry for the mistake I made. For the issue about reverse engineering fails on yield statements, could you please give me some samples? Thanks!

Best regards,
Lilian Wong

No worries.
Here is a trivial example:

Python 2.4 (#1, Dec 4 2007, 14:56:30)
[GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information
%python

from future import generators
def gen():
yield 1

g = gen()
g.next()
1

See python docs for more info: http://docs.python.org/ref/yield.html

Thanks,
Ryan

Hi Rheniser,

Thanks for your example. I’ve passed the issue to our engineers to follow-up. If there is any news about this issue, I’ll come back to you at once.

If there is anything I can do to help, please feel free to ask.

Best regards,
Lilian Wong

Hi Rheniser,

Sorry for the delay. For the reversing Python on yield statements, we’ve tried but cannot repeat your problem. Would you mind to send me a file for reversing that can repeat your problem? Thanks in advance!

*If you do not want he file to be accessed by public, please send it to lilian@visual-paradigm.com

Looking forward to hearing your reply.

Best regards,
Lilian Wong

[quote=LilianWong]Hi Rheniser,

Sorry for the delay. For the reversing Python on yield statements, we’ve tried but cannot repeat your problem. Would you mind to send me a file for reversing that can repeat your problem? Thanks in advance!

*If you do not want he file to be accessed by public, please send it to lilian@visual-paradigm.com

Looking forward to hearing your reply.

Best regards,
Lilian Wong[/quote]

hello Lilian,

I try a demo version and get same error like rheniser before.
Here is small sample:


# -*- coding: ISO-8859-1 -*-
import search

def testspeed(tracefile):
    file = open(tracefile, "r", search.INPUT_BUFFERSIZE) 
    file.seek(0)
    count, start, end = 0, 0, 0
    lines = file.xreadlines()
    for line in lines:
        count += 1
        start = end
        end = start + len(line)
        matchline = search.tracelineExpr.search(line.upper())
        
        if matchline:
            yield line
    file.close()
    return

I get following msg: Error occured when analysis: [path]\test.py. invalid syntax (Line: 16 Column: 19) this is exact after yield-Token :wink:

Hi user,

Thanks for your sample, I’ve forwarded the issue to our engineers to follow-up. If there is any news on this issue, I’ll come back to you at once.

At the mean time, if you need any help, please feel free to contact me.

Best regards,
Lilian Wong

[quote=LilianWong]Hi user,

Thanks for your sample, I’ve forwarded the issue to our engineers to follow-up. If there is any news on this issue, I’ll come back to you at once.

At the mean time, if you need any help, please feel free to contact me.

Best regards,
Lilian Wong[/quote]
At mean time, the workaround is to comment out all yield’s. These does not care since VP-UML make only Class Diagram, so You can remove comments after built a Diagram.

Another Question: how to get Fields into Diagram? Cause I see only Properties and Methods for each Class.

Code example:

  
class test(object):
  def __init__(self):
    self.a = ''
    return
  def GetA(self):
    return self.a
  A = property(fget=GetA)

For this code i will get just A and GetA(), but what about a? Since I get init() in diagram too, but at least for older Python-Versions every Name that begin with __ should be private-like and not visible. Instead of this i should get Constructor for my Class.

Your Tool is easy to use, but with lot of limitations.

Hi user,

Thanks for your post and we are sorry for any inconvenience caused, but we’ll try our best to optimize our tool.
I’ve forwarded the issues to our engineers to investigate, and if there is any feedback, sure I’ll come back to you immediately.

Best regards,
Lilian Wong