Bug 452702 - Curly brackets disappear on python import
Summary: Curly brackets disappear on python import
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: importer (show other bugs)
Version: 2.33.2 (KDE releases 20.12.2)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-17 15:32 UTC by rolf Schmidt
Modified: 2022-04-17 22:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 2.34.70 (KDE releases 22.07.70)
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rolf Schmidt 2022-04-17 15:32:53 UTC
SUMMARY
***
If python code is imported all curly brackets disappear in the attribute text.
***

STEPS TO REPRODUCE
1. 
# python code
#!/usr/bin/python3

class test(object):
   def abc():
     xyz={'aaa':1, 'bbb':'John'}
2. 
import sourcecode
3. 
OBSERVED RESULT
xyz=:
  'aaa':1,'bbb':'John'

EXPECTED RESULT
xyz={ 'aaa':1,'bbb':'John'}

SOFTWARE/OS VERSIONS
Devuan Chimera (i.e. debian bullseys)
GUI: Trinity
Comment 1 Oliver Kellogg 2022-04-17 22:18:48 UTC
Git commit 129462a49a0943ec6925f35d93ec55a80114b159 by Oliver Kellogg.
Committed on 17/04/2022 at 22:18.
Pushed by okellogg into branch 'master'.

Fix "Curly brackets disappear on python import"

umbrello/codeimport/pythonimport.cpp function skipBody
- Add bool dictInitializer initialized to false.
- In while-loop :
  - If token is "}" then
    - if dictInitializer is true then append '}' to body and set
      dictInitializer false;
    - move braceNesting related code to else-part of this if-statement.
  - If token is "{" then
    - if previous token is "=" then append '{' to body and set
      dictInitializer true;
    - move braceNesting related code to else-part of this if-statement.
FIXED-IN: 2.34.70 (KDE releases 22.07.70)

M  +17   -5    umbrello/codeimport/pythonimport.cpp

https://invent.kde.org/sdk/umbrello/commit/129462a49a0943ec6925f35d93ec55a80114b159