mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Update crayons patch
Signed-off-by: Dan Ryan <dan@danryan.co> Update crayons Signed-off-by: Dan Ryan <dan@danryan.co> Fix crayons patch Signed-off-by: Dan Ryan <dan@danryan.co> Fix crayons patch Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
diff --git a/crayons.py b/crayons.py
|
||||
index 5c68e0d..de735da 100644
|
||||
--- a/crayons.py
|
||||
+++ b/crayons.py
|
||||
diff --git a/pipenv/patched/crayons.py b/pipenv/patched/crayons.py
|
||||
index 455d3e90..de735daf 100644
|
||||
--- a/pipenv/patched/crayons.py
|
||||
+++ b/pipenv/patched/crayons.py
|
||||
@@ -12,41 +12,72 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
-PY3 = sys.version_info[0] >= 3
|
||||
-
|
||||
+import shellingham
|
||||
import colorama
|
||||
|
||||
PY3 = sys.version_info[0] >= 3
|
||||
|
||||
+PY3 = sys.version_info[0] >= 3
|
||||
+
|
||||
__all__ = (
|
||||
- 'red', 'green', 'yellow', 'blue',
|
||||
- 'black', 'magenta', 'cyan', 'white', 'normal',
|
||||
- 'black', 'magenta', 'cyan', 'white',
|
||||
- 'clean', 'disable'
|
||||
+ "red",
|
||||
+ "green",
|
||||
@@ -85,7 +87,7 @@ index 5c68e0d..de735da 100644
|
||||
self.always_color = True
|
||||
|
||||
def __getattr__(self, att):
|
||||
@@ -62,16 +93,19 @@ class ColoredString(object):
|
||||
@@ -62,12 +93,19 @@ class ColoredString(object):
|
||||
return [self._new(x) for x in result]
|
||||
else:
|
||||
return result
|
||||
@@ -95,11 +97,7 @@ index 5c68e0d..de735da 100644
|
||||
@property
|
||||
def color_str(self):
|
||||
- style = 'BRIGHT' if self.bold else 'NORMAL'
|
||||
- c = '%s%s%s%s%s' % (getattr(colorama.Fore, self.color),
|
||||
- getattr(colorama.Style, style),
|
||||
- self.s,
|
||||
- colorama.Fore.RESET,
|
||||
- getattr(colorama.Style, 'NORMAL'))
|
||||
- c = '%s%s%s%s%s' % (getattr(colorama.Fore, self.color), getattr(colorama.Style, style), self.s, colorama.Fore.RESET, getattr(colorama.Style, 'NORMAL'))
|
||||
+ style = "BRIGHT" if self.bold else "NORMAL"
|
||||
+ c = "%s%s%s%s%s" % (
|
||||
+ getattr(colorama.Fore, self.color),
|
||||
@@ -111,7 +109,15 @@ index 5c68e0d..de735da 100644
|
||||
|
||||
if self.always_color:
|
||||
return c
|
||||
@@ -89,12 +123,13 @@ class ColoredString(object):
|
||||
@@ -76,7 +114,6 @@ class ColoredString(object):
|
||||
else:
|
||||
return self.s
|
||||
|
||||
-
|
||||
def __len__(self):
|
||||
return len(self.s)
|
||||
|
||||
@@ -86,12 +123,13 @@ class ColoredString(object):
|
||||
def __unicode__(self):
|
||||
value = self.color_str
|
||||
if isinstance(value, bytes):
|
||||
@@ -126,7 +132,7 @@ index 5c68e0d..de735da 100644
|
||||
def __str__(self):
|
||||
return self.color_str
|
||||
|
||||
@@ -108,56 +143,59 @@ class ColoredString(object):
|
||||
@@ -105,45 +143,60 @@ class ColoredString(object):
|
||||
return str(other) + str(self.color_str)
|
||||
|
||||
def __mul__(self, other):
|
||||
@@ -153,50 +159,50 @@ index 5c68e0d..de735da 100644
|
||||
return txt
|
||||
|
||||
|
||||
def normal(string, always=False, bold=False):
|
||||
- return ColoredString('RESET', string, always_color=always, bold=bold)
|
||||
+def normal(string, always=False, bold=False):
|
||||
+ return ColoredString("RESET", string, always_color=always, bold=bold)
|
||||
|
||||
|
||||
+
|
||||
+
|
||||
def black(string, always=False, bold=False):
|
||||
- return ColoredString('BLACK', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("BLACK", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def red(string, always=False, bold=False):
|
||||
- return ColoredString('RED', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("RED", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def green(string, always=False, bold=False):
|
||||
- return ColoredString('GREEN', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("GREEN", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def yellow(string, always=False, bold=False):
|
||||
- return ColoredString('YELLOW', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("YELLOW", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def blue(string, always=False, bold=False):
|
||||
- return ColoredString('BLUE', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("BLUE", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def magenta(string, always=False, bold=False):
|
||||
- return ColoredString('MAGENTA', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("MAGENTA", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def cyan(string, always=False, bold=False):
|
||||
- return ColoredString('CYAN', string, always_color=always, bold=bold)
|
||||
+ return ColoredString("CYAN", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def white(string, always=False, bold=False):
|
||||
- return ColoredString('WHITE', string, always_color=always, bold=bold)
|
||||
+ # This upsets people...
|
||||
+ return ColoredString("WHITE", string, always_color=always, bold=bold)
|
||||
|
||||
+
|
||||
|
||||
def disable():
|
||||
"""Disables colors."""
|
||||
|
||||
Reference in New Issue
Block a user