-
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code refactoring, more readable and easier to modify (#736)
* Add global variables * Add global variables * Code refactoring * Refactoring
- Loading branch information
1 parent
34ebd04
commit 6f7e469
Showing
20 changed files
with
456 additions
and
1,002 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
import subprocess | ||
from subprocess import PIPE, run | ||
|
||
from auto_cpufreq.battery_scripts.thinkpad import thinkpad_setup, thinkpad_print_thresholds | ||
from auto_cpufreq.battery_scripts.ideapad_acpi import ideapad_acpi_setup, ideapad_acpi_print_thresholds | ||
from auto_cpufreq.battery_scripts.ideapad_laptop import ideapad_laptop_setup, ideapad_laptop_print_thresholds | ||
from auto_cpufreq.battery_scripts.ideapad_acpi import ideapad_acpi_print_thresholds, ideapad_acpi_setup | ||
from auto_cpufreq.battery_scripts.ideapad_laptop import ideapad_laptop_print_thresholds, ideapad_laptop_setup | ||
from auto_cpufreq.battery_scripts.thinkpad import thinkpad_print_thresholds, thinkpad_setup | ||
|
||
def lsmod(module): return module in subprocess.run(['lsmod'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True).stdout | ||
|
||
def battery_setup(): | ||
if lsmod("thinkpad_acpi"): thinkpad_setup() | ||
elif lsmod("ideapad_acpi"): ideapad_acpi_setup() | ||
elif lsmod("ideapad_laptop"): ideapad_laptop_setup() | ||
else: return | ||
def lsmod(module): return module in run(['lsmod'], stdout=PIPE, stderr=PIPE, text=True).stdout | ||
|
||
def battery_get_thresholds(): | ||
if lsmod("thinkpad_acpi"): thinkpad_print_thresholds() | ||
elif lsmod("ideapad_acpi"): ideapad_acpi_print_thresholds() | ||
if lsmod("ideapad_acpi"): ideapad_acpi_print_thresholds() | ||
elif lsmod("ideapad_laptop"): ideapad_laptop_print_thresholds() | ||
elif lsmod("thinkpad_acpi"): thinkpad_print_thresholds() | ||
else: return | ||
|
||
def battery_setup(): | ||
if lsmod("ideapad_acpi"): ideapad_acpi_setup() | ||
elif lsmod("ideapad_laptop"): ideapad_laptop_setup() | ||
elif lsmod("thinkpad_acpi"): thinkpad_setup() | ||
else: return |
This file contains 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
This file contains 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
This file contains 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
Empty file.
Oops, something went wrong.