Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ce1b86

Browse files
committed
Issue #27452: add line counter and crc to IDLE config test dump.
2 parents e3c1d34 + 2279aeb commit 5ce1b86

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

Lib/idlelib/config.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,19 +738,30 @@ def SaveUserCfgFiles(self):
738738
# TODO Revise test output, write expanded unittest
739739
#
740740
if __name__ == '__main__':
741+
from zlib import crc32
742+
line, crc = 0, 0
743+
744+
def sprint(obj):
745+
global line, crc
746+
txt = str(obj)
747+
line += 1
748+
crc = crc32(txt.encode(encoding='utf-8'), crc)
749+
print(txt)
750+
#print('***', line, crc, '***') # uncomment for diagnosis
751+
741752
def dumpCfg(cfg):
742-
print('\n', cfg, '\n')
743-
for key in cfg:
753+
print('\n', cfg, '\n') # has variable '0xnnnnnnnn' addresses
754+
for key in sorted(cfg.keys()):
744755
sections = cfg[key].sections()
745-
print(key)
746-
print(sections)
756+
sprint(key)
757+
sprint(sections)
747758
for section in sections:
748759
options = cfg[key].options(section)
749-
print(section)
750-
print(options)
760+
sprint(section)
761+
sprint(options)
751762
for option in options:
752-
print(option, '=', cfg[key].Get(section, option))
763+
sprint(option + ' = ' + cfg[key].Get(section, option))
764+
753765
dumpCfg(idleConf.defaultCfg)
754766
dumpCfg(idleConf.userCfg)
755-
print(idleConf.userCfg['main'].Get('Theme', 'name'))
756-
#print idleConf.userCfg['highlight'].GetDefHighlight('Foo','normal')
767+
print('\nlines = ', line, ', crc = ', crc, sep='')

0 commit comments

Comments
 (0)