Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packages and cPrint method - pip upgrader also included
- Loading branch information
1 parent
79d85e3
commit e6fede7
Showing
4 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class Colors: | ||
RED = "red" | ||
BLUE = "blue" | ||
GREEN = "green" | ||
WARNING = "warning" | ||
FAIL = "fail" | ||
BOLD = "bold" | ||
UNDERLINE = "underline" | ||
RESET_ALL = "reset_all" | ||
|
||
|
||
class OutputColors: | ||
colors = {Colors.RED: '\033[95m', | ||
Colors.BLUE: '\033[94m', | ||
Colors.GREEN: '\033[92m', | ||
Colors.WARNING: '\033[93m', | ||
Colors.FAIL: '\033[91m', | ||
Colors.BOLD: '\033[1m', | ||
Colors.UNDERLINE: '\033[4m', | ||
Colors.RESET_ALL: '\033[0m'} | ||
|
||
|
||
def cPrint(text: str, color: Colors = None): | ||
colors = OutputColors.colors | ||
if color is None: | ||
color = colors[Colors.RESET_ALL] | ||
print(colors[color] + text + colors[Colors.RESET_ALL]) |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pip | ||
python-telegram-bot |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class PiPUpgrader: | ||
def __init__(self, file: str): | ||
self.__file = file | ||
|
||
def upgradePackages(self): | ||
import subprocess | ||
with open(self.__file, 'r') as f: | ||
requirements = f.read().splitlines() | ||
for requirement in requirements: | ||
subprocess.run(("pip install -U " + requirement).split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
1 comment
on commit e6fede7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e6fede7