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
d23fe9dd
Commit
d23fe9dd
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
09f809a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
mklabels.py
stbi/Lib/site-packages/pip/_vendor/webencodings/mklabels.py
+59
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/webencodings/mklabels.py
0 → 100644
View file @
d23fe9dd
"""
webencodings.mklabels
~~~~~~~~~~~~~~~~~~~~~
Regenarate the webencodings.labels module.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
import
json
try
:
from
urllib
import
urlopen
except
ImportError
:
from
urllib.request
import
urlopen
def
assert_lower
(
string
):
assert
string
==
string
.
lower
()
return
string
def
generate
(
url
):
parts
=
[
'''
\
"""
webencodings.labels
~~~~~~~~~~~~~~~~~~~
Map encoding labels to their name.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
# XXX Do not edit!
# This file is automatically generated by mklabels.py
LABELS = {
'''
]
labels
=
[
(
repr
(
assert_lower
(
label
))
.
lstrip
(
'u'
),
repr
(
encoding
[
'name'
])
.
lstrip
(
'u'
))
for
category
in
json
.
loads
(
urlopen
(
url
)
.
read
()
.
decode
(
'ascii'
))
for
encoding
in
category
[
'encodings'
]
for
label
in
encoding
[
'labels'
]]
max_len
=
max
(
len
(
label
)
for
label
,
name
in
labels
)
parts
.
extend
(
'
%
s:
%
s
%
s,
\n
'
%
(
label
,
' '
*
(
max_len
-
len
(
label
)),
name
)
for
label
,
name
in
labels
)
parts
.
append
(
'}'
)
return
''
.
join
(
parts
)
if
__name__
==
'__main__'
:
print
(
generate
(
'http://encoding.spec.whatwg.org/encodings.json'
))
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