Open
Conversation
Most of the work is done by the 2to3 script. Popen required the
passing of 'universal_newlines=True', otherwise it returns a byte
stream in python3. __future__ import is added for backwards
compatibility. Lightly tested with python2.7, python3.{6,7,8}.
penguinolog
reviewed
Nov 4, 2020
|
|
||
| def getkeyssortedbyvalues(dict): | ||
| return map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items()))) | ||
| return [el[1] for el in sorted([(el[1], el[0]) for el in list(dict.items())])] |
There was a problem hiding this comment.
return [el[1] for el in sorted(((val, key) for key, val in dict.items()))]
penguinolog
reviewed
Nov 4, 2020
| f.write('<tr><th>Name</th><th>Date</th><th>Commits</th><th>Authors</th></tr>') | ||
| # sort the tags by date desc | ||
| tags_sorted_by_date_desc = map(lambda el : el[1], reversed(sorted(map(lambda el : (el[1]['date'], el[0]), data.tags.items())))) | ||
| tags_sorted_by_date_desc = [el[1] for el in reversed(sorted([(el[1]['date'], el[0]) for el in list(data.tags.items())]))] |
There was a problem hiding this comment.
tags_sorted_by_date_desc = [(el[1] for el in sorted((v['date'], k) for k, v in data.tags.items()), reverse=True)]
penguinolog
reviewed
Nov 4, 2020
| fgc.write('%d' % stamp) | ||
| for author in self.authors_to_plot: | ||
| if author in data.changes_by_date_by_author[stamp].keys(): | ||
| if author in list(data.changes_by_date_by_author[stamp].keys()): |
There was a problem hiding this comment.
if author in data.changes_by_date_by_author[stamp]:keys is checked for in expression
penguinolog
reviewed
Nov 4, 2020
| f.write('</tr>') | ||
| max_commits_on_tz = max(data.commits_by_timezone.values()) | ||
| for i in sorted(data.commits_by_timezone.keys(), key = lambda n : int(n)): | ||
| for i in sorted(list(data.commits_by_timezone.keys()), key = lambda n : int(n)): |
There was a problem hiding this comment.
use generator expression: more memory efficient & faster
penguinolog
reviewed
Nov 4, 2020
| # dict['author'] = { 'commits': 512 } - ...key(dict, 'commits') | ||
| def getkeyssortedbyvaluekey(d, key): | ||
| return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys()))) | ||
| return [el[1] for el in sorted([(d[el][key], el) for el in list(d.keys())])] |
There was a problem hiding this comment.
return [el[1] for el in sorted(((v[key], k) for k, v in d.items()))]|
looks like |
eavergara96
approved these changes
Jul 15, 2022
|
Hi! I’ve revived gitstats with Python 3 support in the repository: https://github.com/shenxianpeng/gitstats. Feel free to check it out if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of the work is done by the 2to3 script. Popen required the
passing of 'universal_newlines=True', otherwise it returns a byte
stream in python3. future import is added for backwards
compatibility. Lightly tested with python2.7, python3.{6,7,8}.