{"action":"created","comment":{"url":"https://api.github.com/repos/dmsimard/ara/pulls/comments/63127153","id":63127153,"diff_hunk":"@@ -98,6 +88,51 @@ def default_data():\n     return data\n \n \n+def fields_from_iter(fields, items, xforms=None):\n+    '''Returns column headers and data for use by\n+    `cliff.lister.Lister`.  In this function and in\n+    `fields_from_object`, fields are specified as a list of\n+    `(column_name, object_path)` tuples.  The `object_path` can be\n+    omitted if it can be inferred from the column name by converting\n+    the name to lowercase and converting ' ' to '_'.  For example:\n+\n+        fields = (\n+            ('ID',),\n+            ('Name',),\n+            ('Playbook',),\n+        )\n+\n+    The `xforms` parameter is a dictionary maps column names to\n+    callables that will be used to format the corresponding value.\n+    For example:\n+\n+        xforms = {\n+            'Playbook': lambda p: p.name,\n+        }\n+    '''\n+\n+    xforms = xforms or {}\n+\n+    return (zip(*fields)[0], [\n+        [xform(v) for v, xform in\n+         [(get_field_attr(item, f[0]), f[1]) for f in\n+          [(field, xforms.get(field[0], lambda x: x)) for field in fields]]]\n+        for item in items])\n+\n+\n+def fields_from_object(fields, obj, xforms=None):","path":"ara/utils.py","position":78,"original_position":78,"commit_id":"0b05a5489b311420e050082e12ed99f177b120dd","original_commit_id":"0b05a5489b311420e050082e12ed99f177b120dd","user":{"login":"dmsimard","id":1291204,"avatar_url":"https://avatars.githubusercontent.com/u/1291204?v=3","gravatar_id":"","url":"https://api.github.com/users/dmsimard","html_url":"https://github.com/dmsimard","followers_url":"https://api.github.com/users/dmsimard/followers","following_url":"https://api.github.com/users/dmsimard/following{/other_user}","gists_url":"https://api.github.com/users/dmsimard/gists{/gist_id}","starred_url":"https://api.github.com/users/dmsimard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmsimard/subscriptions","organizations_url":"https://api.github.com/users/dmsimard/orgs","repos_url":"https://api.github.com/users/dmsimard/repos","events_url":"https://api.github.com/users/dmsimard/events{/privacy}","received_events_url":"https://api.github.com/users/dmsimard/received_events","type":"User","site_admin":false},"body":"perhaps xforms could default to {} instead of None ?","created_at":"2016-05-13T02:48:30Z","updated_at":"2016-05-13T02:48:30Z","html_url":"https://github.com/dmsimard/ara/pull/25#discussion_r63127153","pull_request_url":"https://api.github.com/repos/dmsimard/ara/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/comments/63127153"},"html":{"href":"https://github.com/dmsimard/ara/pull/25#discussion_r63127153"},"pull_request":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/dmsimard/ara/pulls/25","id":69931701,"html_url":"https://github.com/dmsimard/ara/pull/25","diff_url":"https://github.com/dmsimard/ara/pull/25.diff","patch_url":"https://github.com/dmsimard/ara/pull/25.patch","issue_url":"https://api.github.com/repos/dmsimard/ara/issues/25","number":25,"state":"open","locked":false,"title":"DRY things up","user":{"login":"larsks","id":82622,"avatar_url":"https://avatars.githubusercontent.com/u/82622?v=3","gravatar_id":"","url":"https://api.github.com/users/larsks","html_url":"https://github.com/larsks","followers_url":"https://api.github.com/users/larsks/followers","following_url":"https://api.github.com/users/larsks/following{/other_user}","gists_url":"https://api.github.com/users/larsks/gists{/gist_id}","starred_url":"https://api.github.com/users/larsks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsks/subscriptions","organizations_url":"https://api.github.com/users/larsks/orgs","repos_url":"https://api.github.com/users/larsks/repos","events_url":"https://api.github.com/users/larsks/events{/privacy}","received_events_url":"https://api.github.com/users/larsks/received_events","type":"User","site_admin":false},"body":"This change removes a lot of boilerplate and dead code through\nutils.py and the cli modules.  A key change in the cli modules is that\nwe can re-use the definition of `fields` from the list action in the\nshow action, thereby ensuring that related commands return consistent\ninformation.","created_at":"2016-05-13T01:34:29Z","updated_at":"2016-05-13T02:48:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"19e3069332c68e467bbef60c33e498596bb4a1ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dmsimard/ara/pulls/25/commits","review_comments_url":"https://api.github.com/repos/dmsimard/ara/pulls/25/comments","review_comment_url":"https://api.github.com/repos/dmsimard/ara/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmsimard/ara/issues/25/comments","statuses_url":"https://api.github.com/repos/dmsimard/ara/statuses/0b05a5489b311420e050082e12ed99f177b120dd","head":{"label":"larsks:dry-things-up","ref":"dry-things-up","sha":"0b05a5489b311420e050082e12ed99f177b120dd","user":{"login":"larsks","id":82622,"avatar_url":"https://avatars.githubusercontent.com/u/82622?v=3","gravatar_id":"","url":"https://api.github.com/users/larsks","html_url":"https://github.com/larsks","followers_url":"https://api.github.com/users/larsks/followers","following_url":"https://api.github.com/users/larsks/following{/other_user}","gists_url":"https://api.github.com/users/larsks/gists{/gist_id}","starred_url":"https://api.github.com/users/larsks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsks/subscriptions","organizations_url":"https://api.github.com/users/larsks/orgs","repos_url":"https://api.github.com/users/larsks/repos","events_url":"https://api.github.com/users/larsks/events{/privacy}","received_events_url":"https://api.github.com/users/larsks/received_events","type":"User","site_admin":false},"repo":{"id":58513542,"name":"ara","full_name":"larsks/ara","owner":{"login":"larsks","id":82622,"avatar_url":"https://avatars.githubusercontent.com/u/82622?v=3","gravatar_id":"","url":"https://api.github.com/users/larsks","html_url":"https://github.com/larsks","followers_url":"https://api.github.com/users/larsks/followers","following_url":"https://api.github.com/users/larsks/following{/other_user}","gists_url":"https://api.github.com/users/larsks/gists{/gist_id}","starred_url":"https://api.github.com/users/larsks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsks/subscriptions","organizations_url":"https://api.github.com/users/larsks/orgs","repos_url":"https://api.github.com/users/larsks/repos","events_url":"https://api.github.com/users/larsks/events{/privacy}","received_events_url":"https://api.github.com/users/larsks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/larsks/ara","description":"ARA - Ansible Run Analysis","fork":true,"url":"https://api.github.com/repos/larsks/ara","forks_url":"https://api.github.com/repos/larsks/ara/forks","keys_url":"https://api.github.com/repos/larsks/ara/keys{/key_id}","collaborators_url":"https://api.github.com/repos/larsks/ara/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/larsks/ara/teams","hooks_url":"https://api.github.com/repos/larsks/ara/hooks","issue_events_url":"https://api.github.com/repos/larsks/ara/issues/events{/number}","events_url":"https://api.github.com/repos/larsks/ara/events","assignees_url":"https://api.github.com/repos/larsks/ara/assignees{/user}","branches_url":"https://api.github.com/repos/larsks/ara/branches{/branch}","tags_url":"https://api.github.com/repos/larsks/ara/tags","blobs_url":"https://api.github.com/repos/larsks/ara/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/larsks/ara/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/larsks/ara/git/refs{/sha}","trees_url":"https://api.github.com/repos/larsks/ara/git/trees{/sha}","statuses_url":"https://api.github.com/repos/larsks/ara/statuses/{sha}","languages_url":"https://api.github.com/repos/larsks/ara/languages","stargazers_url":"https://api.github.com/repos/larsks/ara/stargazers","contributors_url":"https://api.github.com/repos/larsks/ara/contributors","subscribers_url":"https://api.github.com/repos/larsks/ara/subscribers","subscription_url":"https://api.github.com/repos/larsks/ara/subscription","commits_url":"https://api.github.com/repos/larsks/ara/commits{/sha}","git_commits_url":"https://api.github.com/repos/larsks/ara/git/commits{/sha}","comments_url":"https://api.github.com/repos/larsks/ara/comments{/number}","issue_comment_url":"https://api.github.com/repos/larsks/ara/issues/comments{/number}","contents_url":"https://api.github.com/repos/larsks/ara/contents/{+path}","compare_url":"https://api.github.com/repos/larsks/ara/compare/{base}...{head}","merges_url":"https://api.github.com/repos/larsks/ara/merges","archive_url":"https://api.github.com/repos/larsks/ara/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/larsks/ara/downloads","issues_url":"https://api.github.com/repos/larsks/ara/issues{/number}","pulls_url":"https://api.github.com/repos/larsks/ara/pulls{/number}","milestones_url":"https://api.github.com/repos/larsks/ara/milestones{/number}","notifications_url":"https://api.github.com/repos/larsks/ara/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/larsks/ara/labels{/name}","releases_url":"https://api.github.com/repos/larsks/ara/releases{/id}","deployments_url":"https://api.github.com/repos/larsks/ara/deployments","created_at":"2016-05-11T04:10:03Z","updated_at":"2016-05-11T04:10:04Z","pushed_at":"2016-05-13T01:43:34Z","git_url":"git://github.com/larsks/ara.git","ssh_url":"git@github.com:larsks/ara.git","clone_url":"https://github.com/larsks/ara.git","svn_url":"https://github.com/larsks/ara","homepage":"","size":725,"stargazers_count":0,"watchers_count":0,"language":"HTML","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":"dmsimard:dev","ref":"dev","sha":"3be8fb3e2efa911a70cc8500372d43f0fd64956f","user":{"login":"dmsimard","id":1291204,"avatar_url":"https://avatars.githubusercontent.com/u/1291204?v=3","gravatar_id":"","url":"https://api.github.com/users/dmsimard","html_url":"https://github.com/dmsimard","followers_url":"https://api.github.com/users/dmsimard/followers","following_url":"https://api.github.com/users/dmsimard/following{/other_user}","gists_url":"https://api.github.com/users/dmsimard/gists{/gist_id}","starred_url":"https://api.github.com/users/dmsimard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmsimard/subscriptions","organizations_url":"https://api.github.com/users/dmsimard/orgs","repos_url":"https://api.github.com/users/dmsimard/repos","events_url":"https://api.github.com/users/dmsimard/events{/privacy}","received_events_url":"https://api.github.com/users/dmsimard/received_events","type":"User","site_admin":false},"repo":{"id":58235533,"name":"ara","full_name":"dmsimard/ara","owner":{"login":"dmsimard","id":1291204,"avatar_url":"https://avatars.githubusercontent.com/u/1291204?v=3","gravatar_id":"","url":"https://api.github.com/users/dmsimard","html_url":"https://github.com/dmsimard","followers_url":"https://api.github.com/users/dmsimard/followers","following_url":"https://api.github.com/users/dmsimard/following{/other_user}","gists_url":"https://api.github.com/users/dmsimard/gists{/gist_id}","starred_url":"https://api.github.com/users/dmsimard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmsimard/subscriptions","organizations_url":"https://api.github.com/users/dmsimard/orgs","repos_url":"https://api.github.com/users/dmsimard/repos","events_url":"https://api.github.com/users/dmsimard/events{/privacy}","received_events_url":"https://api.github.com/users/dmsimard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmsimard/ara","description":"ARA - Ansible Run Analysis","fork":false,"url":"https://api.github.com/repos/dmsimard/ara","forks_url":"https://api.github.com/repos/dmsimard/ara/forks","keys_url":"https://api.github.com/repos/dmsimard/ara/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmsimard/ara/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmsimard/ara/teams","hooks_url":"https://api.github.com/repos/dmsimard/ara/hooks","issue_events_url":"https://api.github.com/repos/dmsimard/ara/issues/events{/number}","events_url":"https://api.github.com/repos/dmsimard/ara/events","assignees_url":"https://api.github.com/repos/dmsimard/ara/assignees{/user}","branches_url":"https://api.github.com/repos/dmsimard/ara/branches{/branch}","tags_url":"https://api.github.com/repos/dmsimard/ara/tags","blobs_url":"https://api.github.com/repos/dmsimard/ara/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmsimard/ara/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmsimard/ara/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmsimard/ara/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmsimard/ara/statuses/{sha}","languages_url":"https://api.github.com/repos/dmsimard/ara/languages","stargazers_url":"https://api.github.com/repos/dmsimard/ara/stargazers","contributors_url":"https://api.github.com/repos/dmsimard/ara/contributors","subscribers_url":"https://api.github.com/repos/dmsimard/ara/subscribers","subscription_url":"https://api.github.com/repos/dmsimard/ara/subscription","commits_url":"https://api.github.com/repos/dmsimard/ara/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmsimard/ara/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmsimard/ara/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmsimard/ara/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmsimard/ara/contents/{+path}","compare_url":"https://api.github.com/repos/dmsimard/ara/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmsimard/ara/merges","archive_url":"https://api.github.com/repos/dmsimard/ara/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmsimard/ara/downloads","issues_url":"https://api.github.com/repos/dmsimard/ara/issues{/number}","pulls_url":"https://api.github.com/repos/dmsimard/ara/pulls{/number}","milestones_url":"https://api.github.com/repos/dmsimard/ara/milestones{/number}","notifications_url":"https://api.github.com/repos/dmsimard/ara/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmsimard/ara/labels{/name}","releases_url":"https://api.github.com/repos/dmsimard/ara/releases{/id}","deployments_url":"https://api.github.com/repos/dmsimard/ara/deployments","created_at":"2016-05-06T21:20:24Z","updated_at":"2016-05-12T07:03:07Z","pushed_at":"2016-05-13T01:43:34Z","git_url":"git://github.com/dmsimard/ara.git","ssh_url":"git@github.com:dmsimard/ara.git","clone_url":"https://github.com/dmsimard/ara.git","svn_url":"https://github.com/dmsimard/ara","homepage":"","size":716,"stargazers_count":2,"watchers_count":2,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/25"},"html":{"href":"https://github.com/dmsimard/ara/pull/25"},"issue":{"href":"https://api.github.com/repos/dmsimard/ara/issues/25"},"comments":{"href":"https://api.github.com/repos/dmsimard/ara/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmsimard/ara/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/dmsimard/ara/statuses/0b05a5489b311420e050082e12ed99f177b120dd"}}}}