Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
f84edd61
Commit
f84edd61
authored
May 31, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace _build_parts with map and flatten.
parent
4b0aaa92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
setuptools/command/upload_docs.py
setuptools/command/upload_docs.py
+9
-10
No files found.
setuptools/command/upload_docs.py
View file @
f84edd61
...
...
@@ -14,6 +14,7 @@ import zipfile
import
tempfile
import
shutil
import
itertools
import
functools
from
setuptools.extern
import
six
from
setuptools.extern.six.moves
import
http_client
,
urllib
...
...
@@ -96,14 +97,9 @@ class upload_docs(upload):
finally
:
shutil
.
rmtree
(
tmp_dir
)
@
classmethod
def
_build_parts
(
cls
,
data
,
sep_boundary
):
for
key
,
values
in
six
.
iteritems
(
data
):
for
part
in
cls
.
_build_part
(
key
,
values
):
yield
part
@
staticmethod
def
_build_part
(
key
,
values
,
sep_boundary
):
def
_build_part
(
item
,
sep_boundary
):
key
,
values
=
item
title
=
'
\
n
Content-Disposition: form-data; name="%s"'
%
key
# handle multiple entries for the same name
if
not
isinstance
(
values
,
list
):
...
...
@@ -130,10 +126,13 @@ class upload_docs(upload):
sep_boundary
=
b'
\
n
--'
+
boundary
end_boundary
=
sep_boundary
+
b'--'
end_items
=
end_boundary
,
b"
\
n
"
,
b
ody_items
=
itertools
.
chain
(
cls
.
_build_part
s
(
data
,
sep_boundary
)
,
end_items
,
b
uilder
=
functools
.
partial
(
cls
.
_build_part
,
sep_boundary
=
sep_boundary
,
)
part_groups
=
map
(
builder
,
data
.
items
())
parts
=
itertools
.
chain
.
from_iterable
(
part_groups
)
body_items
=
itertools
.
chain
(
parts
,
end_items
)
return
b''
.
join
(
body_items
)
def
upload_file
(
self
,
filename
):
...
...
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