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
01448f4f
Commit
01448f4f
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
9fe39f16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
_internal_utils.py
...Lib/site-packages/pip/_vendor/requests/_internal_utils.py
+42
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/requests/_internal_utils.py
0 → 100644
View file @
01448f4f
# -*- coding: utf-8 -*-
"""
requests._internal_utils
~~~~~~~~~~~~~~
Provides utility functions that are consumed internally by Requests
which depend on extremely few external helpers (such as compat)
"""
from
.compat
import
is_py2
,
builtin_str
,
str
def
to_native_string
(
string
,
encoding
=
'ascii'
):
"""Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise.
"""
if
isinstance
(
string
,
builtin_str
):
out
=
string
else
:
if
is_py2
:
out
=
string
.
encode
(
encoding
)
else
:
out
=
string
.
decode
(
encoding
)
return
out
def
unicode_is_ascii
(
u_string
):
"""Determine if unicode string only contains ASCII characters.
:param str u_string: unicode string to check. Must be unicode
and not Python 2 `str`.
:rtype: bool
"""
assert
isinstance
(
u_string
,
str
)
try
:
u_string
.
encode
(
'ascii'
)
return
True
except
UnicodeEncodeError
:
return
False
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