Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c2be7e5a
Commit
c2be7e5a
authored
Jun 17, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make decorators used in packaging preserve docstrings
parent
68044bf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
Lib/packaging/pypi/simple.py
Lib/packaging/pypi/simple.py
+7
-5
No files found.
Lib/packaging/pypi/simple.py
View file @
c2be7e5a
...
...
@@ -15,8 +15,8 @@ import urllib.parse
import
urllib.error
import
os
from
fnmatch
import
translate
from
functools
import
wraps
from
packaging
import
logger
from
packaging.metadata
import
Metadata
from
packaging.version
import
get_version_predicate
...
...
@@ -53,8 +53,9 @@ REL = re.compile("""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I)
def socket_timeout(timeout=SOCKET_TIMEOUT):
"""
Decorator
to
add
a
socket
timeout
when
requesting
pages
on
PyPI
.
"""
def _socket_timeout(func):
def _socket_timeout(self, *args, **kwargs):
def wrapper(func):
@wraps(func)
def wrapped(self, *args, **kwargs):
old_timeout = socket.getdefaulttimeout()
if hasattr(self, "_timeout"):
timeout = self._timeout
...
...
@@ -63,13 +64,14 @@ def socket_timeout(timeout=SOCKET_TIMEOUT):
return func(self, *args, **kwargs)
finally:
socket.setdefaulttimeout(old_timeout)
return
_socket_timeout
return
_socket_timeout
return
wrapped
return
wrapper
def with_mirror_support():
"""
Decorator
that
makes
the
mirroring
support
easier
"""
def wrapper(func):
@wraps(func)
def wrapped(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
...
...
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