SHARE
    TWEET
    Krenair

    MCP Stats

    Jul 17th, 2012
    94
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Python 2.23 KB | None | 0 0
    1. import ContributorTools
    2. stats = {
    3. 'client': {
    4. 'methods': {'total': 0, 'renamed': 0, 'unnamed': 0},
    5. 'fields': {'total': 0, 'renamed': 0, 'unnamed': 0},
    6. 'both': {'total': 0, 'renamed': 0, 'unnamed': 0}
    7. },
    8. 'server': {
    9. 'methods': {'total': 0, 'renamed': 0, 'unnamed': 0},
    10. 'fields': {'total': 0, 'renamed': 0, 'unnamed': 0},
    11. 'both': {'total': 0, 'renamed': 0, 'unnamed': 0}
    12. },
    13. 'both': {
    14. 'methods': {'total': 0, 'renamed': 0, 'unnamed': 0},
    15. 'fields': {'total': 0, 'renamed': 0, 'unnamed': 0},
    16. 'both': {'total': 0, 'renamed': 0, 'unnamed': 0}
    17. }
    18. }
    19. def recordStat(side, memberType, stat):
    20. stats[side][memberType][stat] += 1
    21. stats[side]['both'][stat] += 1
    22. stats['both'][memberType][stat] += 1
    23. stats['both']['both'][stat] += 1
    24. for side, sideMembers in ContributorTools.getAllMembers().items():
    25. sideName = {'0': 'client', '1': 'server'}[side]
    26. for name, info in sideMembers.items():
    27. memberType = {'func_': 'methods', 'field': 'fields'}[info['searge'][:5]]
    28. recordStat(sideName, memberType, 'total')
    29. if info['searge'] == info['name'] and info['desc'] == '':
    30. recordStat(sideName, memberType, 'unnamed')
    31. else:
    32. recordStat(sideName, memberType, 'renamed')
    33. def output(d):
    34. p = str(round(float(d['renamed']) / float(d['total']) * 100, 2)).ljust(5, '0')
    35. return ' T ' + str(d['total']) + ' | R ' + str(d['renamed']) + ' | U ' + str(d['unnamed']) + ' | ' + p + '%'
    36. def outputBig(d):
    37. p = str(round(float(d['renamed']) / float(d['total']) * 100, 2)).ljust(5, '0')
    38. return ' T' + str(d['total']) + ' | R' + str(d['renamed']) + ' | U' + str(d['unnamed']) + ' | ' + p + '%'
    39. print '[C][METHODS] :' + output(stats['client']['methods'])
    40. print '[C][ FIELDS] :' + output(stats['client']['fields'])
    41. print '[C][ BOTH] :' + output(stats['client']['both'])
    42. print '[S][METHODS] :' + output(stats['server']['methods'])
    43. print '[S][ FIELDS] :' + output(stats['server']['fields'])
    44. print '[S][ BOTH] :' + output(stats['server']['both'])
    45. print '[B][METHODS] :' + output(stats['both']['methods'])
    46. print '[B][ FIELDS] :' + output(stats['both']['fields'])
    47. print '[B][ BOTH] :' + outputBig(stats['both']['both'])
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /