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
31fd4823
Commit
31fd4823
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
0c812765
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
makefile.py
...ckages/pip/_vendor/urllib3/packages/backports/makefile.py
+52
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py
0 → 100644
View file @
31fd4823
# -*- coding: utf-8 -*-
"""
backports.makefile
~~~~~~~~~~~~~~~~~~
Backports the Python 3 ``socket.makefile`` method for use with anything that
wants to create a "
fake
" socket object.
"""
import
io
from
socket
import
SocketIO
def
backport_makefile(
self,
mode
=
"r"
,
buffering
=
None,
encoding
=
None,
errors
=
None,
newline
=
None
)
:
"""
Backport of ``socket.makefile`` from Python 3.5.
"""
if not set(mode) <= {"r", "w", "b"}
:
raise
ValueError(
"invalid mode %r (only r, w, b allowed)"
%
(mode,))
writing
=
"w"
in
mode
reading
=
"r"
in
mode or not writing
assert
reading
or
writing
binary
=
"b"
in
mode
rawmode
=
""
if reading
:
rawmode
+=
"r"
if writing
:
rawmode
+=
"w"
raw
=
SocketIO
(
self, rawmode
)
self._makefile_refs
+=
1
if buffering is None
:
buffering
=
-1
if buffering < 0
:
buffering
=
io.DEFAULT_BUFFER_SIZE
if buffering == 0
:
if not binary
:
raise
ValueError(
"unbuffered streams must be binary"
)
return
raw
if reading and writing
:
buffer
=
io.BufferedRWPair
(
raw, raw, buffering
)
elif reading
:
buffer
=
io.BufferedReader
(
raw, buffering
)
else
:
assert
writing
buffer
=
io.BufferedWriter
(
raw, buffering
)
if binary
:
return
buffer
text
=
io.TextIOWrapper
(
buffer, encoding, errors, newline
)
text.mode
=
mode
return
text
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