Created attachment 146130 [details] source code to import Python class functions return value wrong, after importing python code. STEPS TO REPRODUCE 1. Import file entity.py 2. Make the class diagram by dropping from treeview 3. Python class functions return value wrong Examples: def validDirection(self, direction): if direction is not STOP: if self.name in self.node.access[direction]: if self.node.neighbors[direction] is not None: return True return False (this returns string in class widget while it's a boolean) More errors like this (see python code) OBSERVED RESULT Python class functions return value wrong EXPECTED RESULT Return value should be the same as in source code SOFTWARE/OS VERSIONS Windows: git 126264fd KDE binary factory ADDITIONAL INFORMATION
Git commit 71d1bfab86662c976c6e23dcc3b9cad47e324c81 by Oliver Kellogg. Committed on 01/02/2022 at 22:22. Pushed by okellogg into branch 'master'. Fix "Python class functions return value wrong in class widget" umbrello/codeimport/nativeimportbase.{h,cpp} - New function current() acts as shorthand for m_source[m_srcIndex]. umbrello/codeimport/pythonimport.{h,cpp} - At function skipBody change type of argument foundReturn to Uml::PrimitiveTypes::Enum. For details see function documentation. umbrello/codeimport/pythonimport.cpp - In function fillSource, if first character is '-' then - if next character is '>' then append type hint token in m_source and shift the loop start index to 2; - else if next character is a digit then put the two characters to lexeme (start of negative number) and shift loop start index to 2. - In function skipBody handling of token "return" decode following token into one of the Uml::PrimitiveTypes::Enum values Boolean, Integer, Real, or String. If no "return" statement is encountered then set *foundReturn to Reserved. - In functions parseInitializer and parseMethodParameters, on handling type string use Python type "str". - In function parseStmt, if type hint exists then set returnTypeName from the type hint; otherwise decode foundReturn as returned by skipBody() to returnTypeName. FIXED-IN:2.33.80 (KDE releases 22.03.80) M +11 -0 umbrello/codeimport/nativeimportbase.cpp M +2 -1 umbrello/codeimport/nativeimportbase.h M +73 -20 umbrello/codeimport/pythonimport.cpp M +2 -2 umbrello/codeimport/pythonimport.h https://invent.kde.org/sdk/umbrello/commit/71d1bfab86662c976c6e23dcc3b9cad47e324c81
Git commit 5ed8d6bdb9bb04fe39645096d43cbea7e437d202 by Oliver Kellogg. Committed on 15/02/2022 at 05:53. Pushed by okellogg into branch 'master'. umbrello/codeimport/pythonimport.cpp function parseMethodParameters : Add support for type hints. Related: bug 432688 M +35 -17 umbrello/codeimport/pythonimport.cpp https://invent.kde.org/sdk/umbrello/commit/5ed8d6bdb9bb04fe39645096d43cbea7e437d202