def _extract_battery_info_from_acpi(self):
def _parse_battery_info(acpi_battery_lines):<EOL><INDENT>battery = {}<EOL>battery["<STR_LIT>"] = int(<EOL>findall("<STR_LIT>", acpi_battery_lines[<NUM_LIT:0>])[<NUM_LIT:0>]<EOL>)<EOL>battery["<STR_LIT>"] = "<STR_LIT>" in acpi_battery_lines[<NUM_LIT:0>]<EOL>battery["<STR_LIT>"] = int(<EOL>findall("<STR_LIT>", acpi_battery_lines[<NUM_LIT:1>])[<NUM_LIT:1>]<EOL>)<EOL>try:<EOL><INDENT>battery["<STR_LIT>"] = "<STR_LIT>".join(<EOL>findall(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>acpi_battery_lines[<NUM_LIT:0>],<EOL>)[<NUM_LIT:0>]<EOL>)<EOL><DEDENT>except IndexError:<EOL><INDENT>battery["<STR_LIT>"] = FULLY_CHARGED<EOL><DEDENT>return battery<EOL><DEDENT>acpi_list = self.py3.command_output(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]).splitlines()<EOL>acpi_list = [acpi_list[i : i + <NUM_LIT:2>] for i in range(<NUM_LIT:0>, len(acpi_list) - <NUM_LIT:1>, <NUM_LIT:2>)]<EOL>return [_parse_battery_info(battery) for battery in acpi_list]<EOL>
Get the battery info from acpi

# Example acpi -bi raw output (Discharging):
Battery 0: Discharging, 94%, 09:23:28 remaining
Battery 0: design capacity 5703 mAh, last full capacity 5283 mAh = 92%
Battery 1: Unknown, 98%
Battery 1: design capacity 1880 mAh, last full capacity 1370 mAh = 72%

# Example Charging
Battery 0: Charging, 96%, 00:20:40 until charged
Battery 0: design capacity 5566 mAh, last full capacity 5156 mAh = 92%
Battery 1: Unknown, 98%
Battery 1: design capacity 1879 mAh, last full capacity 1370 mAh = 72%