GitHub PullRequestReviewCommentEvent at 2014-12-15 23:20:32
Repository: astropy
Actor: mhvk
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/21866166","id":21866166,"diff_hunk":"@@ -219,8 +218,23 @@ def _pformat_col(self, col, max_lines=None, show_name=True, show_unit=None):\n             col_strs[outs['i_dashes']] = '-' * col_width\n \n         # Now bring all the column string values to the same fixed width\n+        justify_functions = {'<': str.ljust, '^': str.center, '>': str.rjust}\n+        try:\n+            # if col.format is not a string, this raises an exception, causing a default to 'rjust'.\n+            if col.format[:2] == '0=':\n+                justify = str.zfill\n+            else:\n+                justify = justify_functions.get(col.format[0], None)\n+                if justify is None:\n+                    # try whether a fill character precedes the justification character\n+                    # (if not, this will raise an exception, causing a default to rjust below)\n+                    justify_function = justify_functions[col.format[1]]\n+                    justify = lambda str, col_width: justify_function(str, col_width, col.format[0])","path":"astropy/table/pprint.py","position":23,"original_position":23,"commit_id":"ae5e5bc57549f657e228f2d6cdf3ea04c76f8a75","original_commit_id":"ae5e5bc57549f657e228f2d6cdf3ea04c76f8a75","user":{"login":"mhvk","id":2789820,"avatar_url":"https://avatars.githubusercontent.com/u/2789820?v=3","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false},"body":"If you are making changes anyway, could you change `str` to `col_str` in the `lambda`? (twice, of course) I realise it probably comes directly from my example, but it is confusing to use the same name as a built-in.","created_at":"2014-12-15T23:20:32Z","updated_at":"2014-12-15T23:20:32Z","html_url":"https://github.com/astropy/astropy/pull/3037#discussion_r21866166","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/3037","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/21866166"},"html":{"href":"https://github.com/astropy/astropy/pull/3037#discussion_r21866166"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3037"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/3037","id":22968288,"html_url":"https://github.com/astropy/astropy/pull/3037","diff_url":"https://github.com/astropy/astropy/pull/3037.diff","patch_url":"https://github.com/astropy/astropy/pull/3037.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3037","number":3037,"state":"open","locked":false,"title":"Do final alignment based on presence of <,>,^,0= in format string","user":{"login":"agroener","id":3950422,"avatar_url":"https://avatars.githubusercontent.com/u/3950422?v=3","gravatar_id":"","url":"https://api.github.com/users/agroener","html_url":"https://github.com/agroener","followers_url":"https://api.github.com/users/agroener/followers","following_url":"https://api.github.com/users/agroener/following{/other_user}","gists_url":"https://api.github.com/users/agroener/gists{/gist_id}","starred_url":"https://api.github.com/users/agroener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agroener/subscriptions","organizations_url":"https://api.github.com/users/agroener/orgs","repos_url":"https://api.github.com/users/agroener/repos","events_url":"https://api.github.com/users/agroener/events{/privacy}","received_events_url":"https://api.github.com/users/agroener/received_events","type":"User","site_admin":false},"body":"Beginning to finalize the table-column alignment options for pprint in Table package.","created_at":"2014-10-18T14:10:06Z","updated_at":"2014-12-15T23:20:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c6e1dd20fb7bd60083303c4b37e7986dc8a2110","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/3037/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/3037/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3037/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/ae5e5bc57549f657e228f2d6cdf3ea04c76f8a75","head":{"label":"agroener:amg/table-format-alignment","ref":"amg/table-format-alignment","sha":"ae5e5bc57549f657e228f2d6cdf3ea04c76f8a75","user":{"login":"agroener","id":3950422,"avatar_url":"https://avatars.githubusercontent.com/u/3950422?v=3","gravatar_id":"","url":"https://api.github.com/users/agroener","html_url":"https://github.com/agroener","followers_url":"https://api.github.com/users/agroener/followers","following_url":"https://api.github.com/users/agroener/following{/other_user}","gists_url":"https://api.github.com/users/agroener/gists{/gist_id}","starred_url":"https://api.github.com/users/agroener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agroener/subscriptions","organizations_url":"https://api.github.com/users/agroener/orgs","repos_url":"https://api.github.com/users/agroener/repos","events_url":"https://api.github.com/users/agroener/events{/privacy}","received_events_url":"https://api.github.com/users/agroener/received_events","type":"User","site_admin":false},"repo":{"id":24102086,"name":"astropy","full_name":"agroener/astropy","owner":{"login":"agroener","id":3950422,"avatar_url":"https://avatars.githubusercontent.com/u/3950422?v=3","gravatar_id":"","url":"https://api.github.com/users/agroener","html_url":"https://github.com/agroener","followers_url":"https://api.github.com/users/agroener/followers","following_url":"https://api.github.com/users/agroener/following{/other_user}","gists_url":"https://api.github.com/users/agroener/gists{/gist_id}","starred_url":"https://api.github.com/users/agroener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agroener/subscriptions","organizations_url":"https://api.github.com/users/agroener/orgs","repos_url":"https://api.github.com/users/agroener/repos","events_url":"https://api.github.com/users/agroener/events{/privacy}","received_events_url":"https://api.github.com/users/agroener/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/agroener/astropy","description":"Repository for the Astropy core package","fork":true,"url":"https://api.github.com/repos/agroener/astropy","forks_url":"https://api.github.com/repos/agroener/astropy/forks","keys_url":"https://api.github.com/repos/agroener/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agroener/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agroener/astropy/teams","hooks_url":"https://api.github.com/repos/agroener/astropy/hooks","issue_events_url":"https://api.github.com/repos/agroener/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/agroener/astropy/events","assignees_url":"https://api.github.com/repos/agroener/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/agroener/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/agroener/astropy/tags","blobs_url":"https://api.github.com/repos/agroener/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agroener/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agroener/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/agroener/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agroener/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/agroener/astropy/languages","stargazers_url":"https://api.github.com/repos/agroener/astropy/stargazers","contributors_url":"https://api.github.com/repos/agroener/astropy/contributors","subscribers_url":"https://api.github.com/repos/agroener/astropy/subscribers","subscription_url":"https://api.github.com/repos/agroener/astropy/subscription","commits_url":"https://api.github.com/repos/agroener/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/agroener/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/agroener/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/agroener/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/agroener/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/agroener/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agroener/astropy/merges","archive_url":"https://api.github.com/repos/agroener/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agroener/astropy/downloads","issues_url":"https://api.github.com/repos/agroener/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/agroener/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/agroener/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/agroener/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agroener/astropy/labels{/name}","releases_url":"https://api.github.com/repos/agroener/astropy/releases{/id}","created_at":"2014-09-16T14:07:06Z","updated_at":"2014-09-16T15:24:13Z","pushed_at":"2014-12-13T19:02:57Z","git_url":"git://github.com/agroener/astropy.git","ssh_url":"git@github.com:agroener/astropy.git","clone_url":"https://github.com/agroener/astropy.git","svn_url":"https://github.com/agroener/astropy","homepage":"www.astropy.org","size":31170,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"astropy:master","ref":"master","sha":"72da9c6993465c9de8a8149858262adef8b8e075","user":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"repo":{"id":2081289,"name":"astropy","full_name":"astropy/astropy","owner":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astropy/astropy","description":"Repository for the Astropy core package","fork":false,"url":"https://api.github.com/repos/astropy/astropy","forks_url":"https://api.github.com/repos/astropy/astropy/forks","keys_url":"https://api.github.com/repos/astropy/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astropy/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astropy/astropy/teams","hooks_url":"https://api.github.com/repos/astropy/astropy/hooks","issue_events_url":"https://api.github.com/repos/astropy/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/astropy/astropy/events","assignees_url":"https://api.github.com/repos/astropy/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/astropy/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/astropy/astropy/tags","blobs_url":"https://api.github.com/repos/astropy/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astropy/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astropy/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/astropy/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/astropy/astropy/languages","stargazers_url":"https://api.github.com/repos/astropy/astropy/stargazers","contributors_url":"https://api.github.com/repos/astropy/astropy/contributors","subscribers_url":"https://api.github.com/repos/astropy/astropy/subscribers","subscription_url":"https://api.github.com/repos/astropy/astropy/subscription","commits_url":"https://api.github.com/repos/astropy/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/astropy/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/astropy/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/astropy/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/astropy/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/astropy/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astropy/astropy/merges","archive_url":"https://api.github.com/repos/astropy/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astropy/astropy/downloads","issues_url":"https://api.github.com/repos/astropy/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/astropy/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/astropy/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/astropy/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astropy/astropy/labels{/name}","releases_url":"https://api.github.com/repos/astropy/astropy/releases{/id}","created_at":"2011-07-21T01:33:49Z","updated_at":"2014-12-15T23:12:37Z","pushed_at":"2014-12-15T23:12:37Z","git_url":"git://github.com/astropy/astropy.git","ssh_url":"git@github.com:astropy/astropy.git","clone_url":"https://github.com/astropy/astropy.git","svn_url":"https://github.com/astropy/astropy","homepage":"www.astropy.org","size":62337,"stargazers_count":476,"watchers_count":476,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":324,"mirror_url":null,"open_issues_count":422,"forks":324,"open_issues":422,"watchers":476,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3037"},"html":{"href":"https://github.com/astropy/astropy/pull/3037"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/3037"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/3037/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3037/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3037/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/ae5e5bc57549f657e228f2d6cdf3ea04c76f8a75"}}}}