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
272dadfb
Commit
272dadfb
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
5885445b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
initialise.py
stbi/Lib/site-packages/pip/_vendor/colorama/initialise.py
+80
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/colorama/initialise.py
0 → 100644
View file @
272dadfb
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import
atexit
import
contextlib
import
sys
from
.ansitowin32
import
AnsiToWin32
orig_stdout
=
None
orig_stderr
=
None
wrapped_stdout
=
None
wrapped_stderr
=
None
atexit_done
=
False
def
reset_all
():
if
AnsiToWin32
is
not
None
:
# Issue #74: objects might become None at exit
AnsiToWin32
(
orig_stdout
)
.
reset_all
()
def
init
(
autoreset
=
False
,
convert
=
None
,
strip
=
None
,
wrap
=
True
):
if
not
wrap
and
any
([
autoreset
,
convert
,
strip
]):
raise
ValueError
(
'wrap=False conflicts with any other arg=True'
)
global
wrapped_stdout
,
wrapped_stderr
global
orig_stdout
,
orig_stderr
orig_stdout
=
sys
.
stdout
orig_stderr
=
sys
.
stderr
if
sys
.
stdout
is
None
:
wrapped_stdout
=
None
else
:
sys
.
stdout
=
wrapped_stdout
=
\
wrap_stream
(
orig_stdout
,
convert
,
strip
,
autoreset
,
wrap
)
if
sys
.
stderr
is
None
:
wrapped_stderr
=
None
else
:
sys
.
stderr
=
wrapped_stderr
=
\
wrap_stream
(
orig_stderr
,
convert
,
strip
,
autoreset
,
wrap
)
global
atexit_done
if
not
atexit_done
:
atexit
.
register
(
reset_all
)
atexit_done
=
True
def
deinit
():
if
orig_stdout
is
not
None
:
sys
.
stdout
=
orig_stdout
if
orig_stderr
is
not
None
:
sys
.
stderr
=
orig_stderr
@contextlib.contextmanager
def
colorama_text
(
*
args
,
**
kwargs
):
init
(
*
args
,
**
kwargs
)
try
:
yield
finally
:
deinit
()
def
reinit
():
if
wrapped_stdout
is
not
None
:
sys
.
stdout
=
wrapped_stdout
if
wrapped_stderr
is
not
None
:
sys
.
stderr
=
wrapped_stderr
def
wrap_stream
(
stream
,
convert
,
strip
,
autoreset
,
wrap
):
if
wrap
:
wrapper
=
AnsiToWin32
(
stream
,
convert
=
convert
,
strip
=
strip
,
autoreset
=
autoreset
)
if
wrapper
.
should_wrap
():
stream
=
wrapper
.
stream
return
stream
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