Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
news
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sartika Aritonang
news
Commits
8770d971
Commit
8770d971
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
95d6fe1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
0 deletions
+102
-0
ansi.py
stbi/Lib/site-packages/pip/_vendor/colorama/ansi.py
+102
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/colorama/ansi.py
0 → 100644
View file @
8770d971
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI
=
'
\033
['
OSC
=
'
\033
]'
BEL
=
'
\007
'
def
code_to_chars
(
code
):
return
CSI
+
str
(
code
)
+
'm'
def
set_title
(
title
):
return
OSC
+
'2;'
+
title
+
BEL
def
clear_screen
(
mode
=
2
):
return
CSI
+
str
(
mode
)
+
'J'
def
clear_line
(
mode
=
2
):
return
CSI
+
str
(
mode
)
+
'K'
class
AnsiCodes
(
object
):
def
__init__
(
self
):
# the subclasses declare class attributes which are numbers.
# Upon instantiation we define instance attributes, which are the same
# as the class attributes but wrapped with the ANSI escape sequence
for
name
in
dir
(
self
):
if
not
name
.
startswith
(
'_'
):
value
=
getattr
(
self
,
name
)
setattr
(
self
,
name
,
code_to_chars
(
value
))
class
AnsiCursor
(
object
):
def
UP
(
self
,
n
=
1
):
return
CSI
+
str
(
n
)
+
'A'
def
DOWN
(
self
,
n
=
1
):
return
CSI
+
str
(
n
)
+
'B'
def
FORWARD
(
self
,
n
=
1
):
return
CSI
+
str
(
n
)
+
'C'
def
BACK
(
self
,
n
=
1
):
return
CSI
+
str
(
n
)
+
'D'
def
POS
(
self
,
x
=
1
,
y
=
1
):
return
CSI
+
str
(
y
)
+
';'
+
str
(
x
)
+
'H'
class
AnsiFore
(
AnsiCodes
):
BLACK
=
30
RED
=
31
GREEN
=
32
YELLOW
=
33
BLUE
=
34
MAGENTA
=
35
CYAN
=
36
WHITE
=
37
RESET
=
39
# These are fairly well supported, but not part of the standard.
LIGHTBLACK_EX
=
90
LIGHTRED_EX
=
91
LIGHTGREEN_EX
=
92
LIGHTYELLOW_EX
=
93
LIGHTBLUE_EX
=
94
LIGHTMAGENTA_EX
=
95
LIGHTCYAN_EX
=
96
LIGHTWHITE_EX
=
97
class
AnsiBack
(
AnsiCodes
):
BLACK
=
40
RED
=
41
GREEN
=
42
YELLOW
=
43
BLUE
=
44
MAGENTA
=
45
CYAN
=
46
WHITE
=
47
RESET
=
49
# These are fairly well supported, but not part of the standard.
LIGHTBLACK_EX
=
100
LIGHTRED_EX
=
101
LIGHTGREEN_EX
=
102
LIGHTYELLOW_EX
=
103
LIGHTBLUE_EX
=
104
LIGHTMAGENTA_EX
=
105
LIGHTCYAN_EX
=
106
LIGHTWHITE_EX
=
107
class
AnsiStyle
(
AnsiCodes
):
BRIGHT
=
1
DIM
=
2
NORMAL
=
22
RESET_ALL
=
0
Fore
=
AnsiFore
()
Back
=
AnsiBack
()
Style
=
AnsiStyle
()
Cursor
=
AnsiCursor
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment