{"action":"created","comment":{"url":"https://api.github.com/repos/powerline/powerline/pulls/comments/35430319","id":35430319,"diff_hunk":"@@ -65,13 +70,20 @@ def _get_battery(pl):\n \t\t\tcap_path = linux_bat_fmt.format(linux_bat)\n \t\t\tif linux_bat.startswith('BAT') and os.path.exists(cap_path):\n \t\t\t\tpl.debug('Using /sys/class/power_supply with battery {0}', linux_bat)\n-\n-\t\t\t\tdef _get_capacity(pl):\n-\t\t\t\t\twith open(cap_path, 'r') as f:\n-\t\t\t\t\t\treturn int(float(f.readline().split()[0]))\n-\n-\t\t\t\treturn _get_capacity\n-\t\tpl.debug('Not using /sys/class/power_supply as no batteries were found')\n+\t\t\t\twith open(cap_path, 'r') as f:\n+\t\t\t\t\t_capacity = int(float(f.readline().split()[0]))\n+\n+\t\tlinux_ac_fmt = '/sys/class/power_supply/{0}/online'\n+\t\tfor linux_ac in os.listdir('/sys/class/power_supply'):","path":"powerline/segments/common/bat.py","position":43,"original_position":43,"commit_id":"4605b86d9fbbbfed425bf1a2f9c69f52f12cef0a","original_commit_id":"c9ecf63cc41662d711917e73518f15a48476e195","user":{"login":"ZyX-I","id":322097,"avatar_url":"https://avatars.githubusercontent.com/u/322097?v=3","gravatar_id":"","url":"https://api.github.com/users/ZyX-I","html_url":"https://github.com/ZyX-I","followers_url":"https://api.github.com/users/ZyX-I/followers","following_url":"https://api.github.com/users/ZyX-I/following{/other_user}","gists_url":"https://api.github.com/users/ZyX-I/gists{/gist_id}","starred_url":"https://api.github.com/users/ZyX-I/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZyX-I/subscriptions","organizations_url":"https://api.github.com/users/ZyX-I/orgs","repos_url":"https://api.github.com/users/ZyX-I/repos","events_url":"https://api.github.com/users/ZyX-I/events{/privacy}","received_events_url":"https://api.github.com/users/ZyX-I/received_events","type":"User","site_admin":false},"body":"There is already one iteration over `/sys/class/power_supply` contents. Do not use two iterations.","created_at":"2015-07-24T14:59:57Z","updated_at":"2015-07-24T14:59:57Z","html_url":"https://github.com/powerline/powerline/pull/1418#discussion_r35430319","pull_request_url":"https://api.github.com/repos/powerline/powerline/pulls/1418","_links":{"self":{"href":"https://api.github.com/repos/powerline/powerline/pulls/comments/35430319"},"html":{"href":"https://github.com/powerline/powerline/pull/1418#discussion_r35430319"},"pull_request":{"href":"https://api.github.com/repos/powerline/powerline/pulls/1418"}}},"pull_request":{"url":"https://api.github.com/repos/powerline/powerline/pulls/1418","id":40779244,"html_url":"https://github.com/powerline/powerline/pull/1418","diff_url":"https://github.com/powerline/powerline/pull/1418.diff","patch_url":"https://github.com/powerline/powerline/pull/1418.patch","issue_url":"https://api.github.com/repos/powerline/powerline/issues/1418","number":1418,"state":"open","locked":false,"title":"Add ac-charging indication for battery segment","user":{"login":"xfumihiro","id":12194969,"avatar_url":"https://avatars.githubusercontent.com/u/12194969?v=3","gravatar_id":"","url":"https://api.github.com/users/xfumihiro","html_url":"https://github.com/xfumihiro","followers_url":"https://api.github.com/users/xfumihiro/followers","following_url":"https://api.github.com/users/xfumihiro/following{/other_user}","gists_url":"https://api.github.com/users/xfumihiro/gists{/gist_id}","starred_url":"https://api.github.com/users/xfumihiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xfumihiro/subscriptions","organizations_url":"https://api.github.com/users/xfumihiro/orgs","repos_url":"https://api.github.com/users/xfumihiro/repos","events_url":"https://api.github.com/users/xfumihiro/events{/privacy}","received_events_url":"https://api.github.com/users/xfumihiro/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-24T14:18:06Z","updated_at":"2015-07-24T14:59:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66544938af1b76ecb6655c73a69b9e12accc0041","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/powerline/powerline/pulls/1418/commits","review_comments_url":"https://api.github.com/repos/powerline/powerline/pulls/1418/comments","review_comment_url":"https://api.github.com/repos/powerline/powerline/pulls/comments{/number}","comments_url":"https://api.github.com/repos/powerline/powerline/issues/1418/comments","statuses_url":"https://api.github.com/repos/powerline/powerline/statuses/4605b86d9fbbbfed425bf1a2f9c69f52f12cef0a","head":{"label":"xfumihiro:feature/ac-charging-indication","ref":"feature/ac-charging-indication","sha":"4605b86d9fbbbfed425bf1a2f9c69f52f12cef0a","user":{"login":"xfumihiro","id":12194969,"avatar_url":"https://avatars.githubusercontent.com/u/12194969?v=3","gravatar_id":"","url":"https://api.github.com/users/xfumihiro","html_url":"https://github.com/xfumihiro","followers_url":"https://api.github.com/users/xfumihiro/followers","following_url":"https://api.github.com/users/xfumihiro/following{/other_user}","gists_url":"https://api.github.com/users/xfumihiro/gists{/gist_id}","starred_url":"https://api.github.com/users/xfumihiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xfumihiro/subscriptions","organizations_url":"https://api.github.com/users/xfumihiro/orgs","repos_url":"https://api.github.com/users/xfumihiro/repos","events_url":"https://api.github.com/users/xfumihiro/events{/privacy}","received_events_url":"https://api.github.com/users/xfumihiro/received_events","type":"User","site_admin":false},"repo":{"id":38184801,"name":"powerline","full_name":"xfumihiro/powerline","owner":{"login":"xfumihiro","id":12194969,"avatar_url":"https://avatars.githubusercontent.com/u/12194969?v=3","gravatar_id":"","url":"https://api.github.com/users/xfumihiro","html_url":"https://github.com/xfumihiro","followers_url":"https://api.github.com/users/xfumihiro/followers","following_url":"https://api.github.com/users/xfumihiro/following{/other_user}","gists_url":"https://api.github.com/users/xfumihiro/gists{/gist_id}","starred_url":"https://api.github.com/users/xfumihiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xfumihiro/subscriptions","organizations_url":"https://api.github.com/users/xfumihiro/orgs","repos_url":"https://api.github.com/users/xfumihiro/repos","events_url":"https://api.github.com/users/xfumihiro/events{/privacy}","received_events_url":"https://api.github.com/users/xfumihiro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xfumihiro/powerline","description":"Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.","fork":true,"url":"https://api.github.com/repos/xfumihiro/powerline","forks_url":"https://api.github.com/repos/xfumihiro/powerline/forks","keys_url":"https://api.github.com/repos/xfumihiro/powerline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xfumihiro/powerline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xfumihiro/powerline/teams","hooks_url":"https://api.github.com/repos/xfumihiro/powerline/hooks","issue_events_url":"https://api.github.com/repos/xfumihiro/powerline/issues/events{/number}","events_url":"https://api.github.com/repos/xfumihiro/powerline/events","assignees_url":"https://api.github.com/repos/xfumihiro/powerline/assignees{/user}","branches_url":"https://api.github.com/repos/xfumihiro/powerline/branches{/branch}","tags_url":"https://api.github.com/repos/xfumihiro/powerline/tags","blobs_url":"https://api.github.com/repos/xfumihiro/powerline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xfumihiro/powerline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xfumihiro/powerline/git/refs{/sha}","trees_url":"https://api.github.com/repos/xfumihiro/powerline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xfumihiro/powerline/statuses/{sha}","languages_url":"https://api.github.com/repos/xfumihiro/powerline/languages","stargazers_url":"https://api.github.com/repos/xfumihiro/powerline/stargazers","contributors_url":"https://api.github.com/repos/xfumihiro/powerline/contributors","subscribers_url":"https://api.github.com/repos/xfumihiro/powerline/subscribers","subscription_url":"https://api.github.com/repos/xfumihiro/powerline/subscription","commits_url":"https://api.github.com/repos/xfumihiro/powerline/commits{/sha}","git_commits_url":"https://api.github.com/repos/xfumihiro/powerline/git/commits{/sha}","comments_url":"https://api.github.com/repos/xfumihiro/powerline/comments{/number}","issue_comment_url":"https://api.github.com/repos/xfumihiro/powerline/issues/comments{/number}","contents_url":"https://api.github.com/repos/xfumihiro/powerline/contents/{+path}","compare_url":"https://api.github.com/repos/xfumihiro/powerline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xfumihiro/powerline/merges","archive_url":"https://api.github.com/repos/xfumihiro/powerline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xfumihiro/powerline/downloads","issues_url":"https://api.github.com/repos/xfumihiro/powerline/issues{/number}","pulls_url":"https://api.github.com/repos/xfumihiro/powerline/pulls{/number}","milestones_url":"https://api.github.com/repos/xfumihiro/powerline/milestones{/number}","notifications_url":"https://api.github.com/repos/xfumihiro/powerline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xfumihiro/powerline/labels{/name}","releases_url":"https://api.github.com/repos/xfumihiro/powerline/releases{/id}","created_at":"2015-06-28T03:24:35Z","updated_at":"2015-06-28T03:24:36Z","pushed_at":"2015-07-24T14:59:54Z","git_url":"git://github.com/xfumihiro/powerline.git","ssh_url":"git@github.com:xfumihiro/powerline.git","clone_url":"https://github.com/xfumihiro/powerline.git","svn_url":"https://github.com/xfumihiro/powerline","homepage":"https://powerline.readthedocs.org/en/latest/","size":3768,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"powerline:develop","ref":"develop","sha":"090cd1397cf61efe7cd7d7bc389a7e8f8963f707","user":{"login":"powerline","id":10100576,"avatar_url":"https://avatars.githubusercontent.com/u/10100576?v=3","gravatar_id":"","url":"https://api.github.com/users/powerline","html_url":"https://github.com/powerline","followers_url":"https://api.github.com/users/powerline/followers","following_url":"https://api.github.com/users/powerline/following{/other_user}","gists_url":"https://api.github.com/users/powerline/gists{/gist_id}","starred_url":"https://api.github.com/users/powerline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerline/subscriptions","organizations_url":"https://api.github.com/users/powerline/orgs","repos_url":"https://api.github.com/users/powerline/repos","events_url":"https://api.github.com/users/powerline/events{/privacy}","received_events_url":"https://api.github.com/users/powerline/received_events","type":"Organization","site_admin":false},"repo":{"id":4637221,"name":"powerline","full_name":"powerline/powerline","owner":{"login":"powerline","id":10100576,"avatar_url":"https://avatars.githubusercontent.com/u/10100576?v=3","gravatar_id":"","url":"https://api.github.com/users/powerline","html_url":"https://github.com/powerline","followers_url":"https://api.github.com/users/powerline/followers","following_url":"https://api.github.com/users/powerline/following{/other_user}","gists_url":"https://api.github.com/users/powerline/gists{/gist_id}","starred_url":"https://api.github.com/users/powerline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerline/subscriptions","organizations_url":"https://api.github.com/users/powerline/orgs","repos_url":"https://api.github.com/users/powerline/repos","events_url":"https://api.github.com/users/powerline/events{/privacy}","received_events_url":"https://api.github.com/users/powerline/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/powerline/powerline","description":"Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.","fork":false,"url":"https://api.github.com/repos/powerline/powerline","forks_url":"https://api.github.com/repos/powerline/powerline/forks","keys_url":"https://api.github.com/repos/powerline/powerline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/powerline/powerline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/powerline/powerline/teams","hooks_url":"https://api.github.com/repos/powerline/powerline/hooks","issue_events_url":"https://api.github.com/repos/powerline/powerline/issues/events{/number}","events_url":"https://api.github.com/repos/powerline/powerline/events","assignees_url":"https://api.github.com/repos/powerline/powerline/assignees{/user}","branches_url":"https://api.github.com/repos/powerline/powerline/branches{/branch}","tags_url":"https://api.github.com/repos/powerline/powerline/tags","blobs_url":"https://api.github.com/repos/powerline/powerline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/powerline/powerline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/powerline/powerline/git/refs{/sha}","trees_url":"https://api.github.com/repos/powerline/powerline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/powerline/powerline/statuses/{sha}","languages_url":"https://api.github.com/repos/powerline/powerline/languages","stargazers_url":"https://api.github.com/repos/powerline/powerline/stargazers","contributors_url":"https://api.github.com/repos/powerline/powerline/contributors","subscribers_url":"https://api.github.com/repos/powerline/powerline/subscribers","subscription_url":"https://api.github.com/repos/powerline/powerline/subscription","commits_url":"https://api.github.com/repos/powerline/powerline/commits{/sha}","git_commits_url":"https://api.github.com/repos/powerline/powerline/git/commits{/sha}","comments_url":"https://api.github.com/repos/powerline/powerline/comments{/number}","issue_comment_url":"https://api.github.com/repos/powerline/powerline/issues/comments{/number}","contents_url":"https://api.github.com/repos/powerline/powerline/contents/{+path}","compare_url":"https://api.github.com/repos/powerline/powerline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/powerline/powerline/merges","archive_url":"https://api.github.com/repos/powerline/powerline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/powerline/powerline/downloads","issues_url":"https://api.github.com/repos/powerline/powerline/issues{/number}","pulls_url":"https://api.github.com/repos/powerline/powerline/pulls{/number}","milestones_url":"https://api.github.com/repos/powerline/powerline/milestones{/number}","notifications_url":"https://api.github.com/repos/powerline/powerline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/powerline/powerline/labels{/name}","releases_url":"https://api.github.com/repos/powerline/powerline/releases{/id}","created_at":"2012-06-12T12:48:40Z","updated_at":"2015-07-24T09:39:24Z","pushed_at":"2015-07-24T14:59:57Z","git_url":"git://github.com/powerline/powerline.git","ssh_url":"git@github.com:powerline/powerline.git","clone_url":"https://github.com/powerline/powerline.git","svn_url":"https://github.com/powerline/powerline","homepage":"https://powerline.readthedocs.org/en/latest/","size":8612,"stargazers_count":4366,"watchers_count":4366,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":400,"mirror_url":null,"open_issues_count":51,"forks":400,"open_issues":51,"watchers":4366,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/powerline/powerline/pulls/1418"},"html":{"href":"https://github.com/powerline/powerline/pull/1418"},"issue":{"href":"https://api.github.com/repos/powerline/powerline/issues/1418"},"comments":{"href":"https://api.github.com/repos/powerline/powerline/issues/1418/comments"},"review_comments":{"href":"https://api.github.com/repos/powerline/powerline/pulls/1418/comments"},"review_comment":{"href":"https://api.github.com/repos/powerline/powerline/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/powerline/powerline/pulls/1418/commits"},"statuses":{"href":"https://api.github.com/repos/powerline/powerline/statuses/4605b86d9fbbbfed425bf1a2f9c69f52f12cef0a"}}}}