Changeset 3006
- Timestamp:
- Dec 8, 2015, 5:14:35 PM (10 years ago)
- File:
-
- 1 edited
-
scripts/xml-stats/stats.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/xml-stats/stats.py
r3002 r3006 7 7 import xml.etree.ElementTree as ET 8 8 import collections as col 9 import sys 9 import sys, codecs, locale 10 sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) 10 11 11 12 Stat = col.namedtuple('Stat', ['count', 'name', 'branch', 'work', 12 13 'untranslated','fuzzy', 'translated', 'total']) 13 14 14 #titles = Stat(count='Номер', name='Име', branch='Клон', work='Работа', 15 # untranslated='Непреведени', fuzzy='Мъгляви', translated='Преведени', 16 # total='Всичко') 15 titles = Stat(count=('Номер', 'rjust'), name=('Име', 'ljust'), 16 branch=('Клон', 'ljust'), work=('Работа', 'rjust'), 17 untranslated=('Непреведени', 'rjust'), fuzzy=('Мъгляви', 'rjust'), 18 translated=('Преведени', 'rjust'), total=('Всичко', 'rjust')) 17 19 18 titles = Stat(count=('Number', 'rjust'), name=('Name', 'ljust'),19 branch=('Branch', 'ljust'), work=('Work', 'ljust'),20 untranslated=('Untranslated', 'ljust'), fuzzy=('Fuzyy', 'rjust'),21 translated=('Translated', 'rjust'), total=('All', 'rjust'))20 #titles = Stat(count=('Number', 'rjust'), name=('Name', 'ljust'), 21 # branch=('Branch', 'ljust'), work=('Work', 'ljust'), 22 # untranslated=('Untranslated', 'ljust'), fuzzy=('Fuzyy', 'rjust'), 23 # translated=('Translated', 'rjust'), total=('All', 'rjust')) 22 24 23 25 … … 102 104 103 105 def divider(s): 104 inner = '+'.join(['-' * (f + 1) for f in s]) 105 return inner.join(['|'] * 2) 106 inner = '┼'.join(['─' * (f + 1) for f in s]) 107 return '├' + inner + '┤' 108 109 def start(s): 110 inner = '┬'.join(['─' * (f + 1) for f in s]) 111 return '┌' + inner + '┐' 112 113 def end(s): 114 inner = '┴'.join(['─' * (f + 1) for f in s]) 115 return '└' + inner + '┘' 106 116 107 117 … … 114 124 args.append(part) 115 125 116 result = ' |{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|'.format(*tuple(args))126 result = '│{0}│{1}│{2}│{3}│{4}│{5}│{6}│{7}│'.format(*tuple(args)) 117 127 return result 118 128 … … 126 136 args.append(part) 127 137 128 result = ' |{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|'.format(*tuple(args))138 result = '│{0}│{1}│{2}│{3}│{4}│{5}│{6}│{7}│'.format(*tuple(args)) 129 139 return result 130 140 … … 136 146 # print('Give single argument, one of: {} '.format(versions)) 137 147 # print('Will use {}'.format(versions[0])) 138 stats = get_stats('gnome-3- 18')148 stats = get_stats('gnome-3-20') 139 149 sms = stats_max_lengths_sums(stats) 140 150 max_len = sms['max_len'] … … 143 153 print(max_len) 144 154 print(sums) 155 s = start(max_len) 145 156 d = divider(max_len) 146 print(d) 157 e = end(max_len) 158 print(s) 147 159 print(title_line(max_len)) 148 160 print(d) … … 151 163 print(d) 152 164 print(stat_line(max_len, sums)) 165 print(e) 153 166 154 167 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/project/gtp/chrome/site/your_project_logo.png)