-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from realiti4/dev
Dev
- Loading branch information
Showing
10 changed files
with
92 additions
and
10 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
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,5 @@ | ||
from pip_upgrade.tools.cprint import ColoredPrint | ||
from pip_upgrade.tools.config import Config | ||
|
||
# Initialize cprint | ||
cprint = ColoredPrint() |
File renamed without changes.
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,31 @@ | ||
import os | ||
import sys | ||
|
||
class ColoredPrint(): | ||
def __init__(self): | ||
self.enabled = True | ||
self.color_dict = { | ||
'green': '\033[32m', | ||
'yellow': 'notimplemented', | ||
'default': '\033[m' | ||
} | ||
if not self.terminal_check: | ||
self.enabled = False | ||
|
||
def terminal_check(self): | ||
"""Don't print colored if it is cmd""" | ||
return True | ||
|
||
def __call__(self, *input, color='green', disabled=False): | ||
if disabled or not self.enabled: | ||
print(*input) | ||
else: | ||
if isinstance(input, tuple): | ||
print(f"{self.color_dict[color]}{input[0]}{self.color_dict['default']}", *input[1:]) | ||
else: | ||
print(f"{self.color_dict[color]}{input}{self.color_dict['default']}") | ||
|
||
if __name__ == '__main__': | ||
cprint = ColoredPrint() | ||
cprint('heey', 'ha') | ||
print('de') |
File renamed without changes.
File renamed without changes.
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,31 @@ | ||
import pytest | ||
import argparse | ||
|
||
from pip_upgrade.tool import PipUpgrade | ||
from pip_upgrade.utils.config import Config | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-e', '--exclude', nargs='+', help="Exclude packages you don't want to upgrade") | ||
parser.add_argument('--local', action='store_true', help="Upgrades local packages as well") | ||
parser.add_argument('--novenv', action='store_true', help="Disables venv check") | ||
parser.add_argument('--clear', action='store_true', help="Clears pip's cache") # Deprecated | ||
parser.add_argument('--clean', action='store_true', help="Clears pip's cache") | ||
parser.add_argument('-y', '--yes', action='store_true', help="Accept all upgrades and skip user prompt") | ||
parser.add_argument('--reset-config', action='store_true', help='Reset config file to default') | ||
parser.add_argument('--dev', action='store_true', help="Doesn't actually call upgrade at the end") | ||
|
||
args = parser.parse_args() | ||
|
||
def test_main(): | ||
config = Config() | ||
|
||
args.dev = True | ||
args.yes = True | ||
|
||
pip_upgrade = PipUpgrade(args, config) | ||
|
||
pip_upgrade.get_dependencies() | ||
|
||
pip_upgrade.upgrade() | ||
|