Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
d2ee6d7e
Commit
d2ee6d7e
authored
Jul 24, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow building the socket module docs for both python 2 and 3. [skip ci]
parent
8d7fea5d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
18 deletions
+41
-18
doc/dns.rst
doc/dns.rst
+3
-1
doc/generate_rst.py
doc/generate_rst.py
+2
-1
gevent/_socket2.py
gevent/_socket2.py
+19
-5
gevent/_socket3.py
gevent/_socket3.py
+3
-1
gevent/_socketcommon.py
gevent/_socketcommon.py
+14
-10
No files found.
doc/dns.rst
View file @
d2ee6d7e
...
...
@@ -31,7 +31,9 @@ variable. Specify ``ares``, ``thread``, or ``block`` to use the
:class:`gevent.resolver_ares.Resolver`,
:class:`gevent.resolver_thread.Resolver`, or
:class:`gevent.socket.BlockingResolver`, respectively, or set it to
the fully-qualified name of an implementation of the standard functions.
the fully-qualified name of an implementation of the standard
functions.
.. toctree::
gevent.resolver_thread
...
...
doc/generate_rst.py
View file @
d2ee6d7e
...
...
@@ -25,7 +25,8 @@ directory = dirname(abspath(gevent.__file__))
print
(
'Imported gevent from %s'
%
(
directory
,
))
modules
=
glob
.
glob
(
join
(
directory
,
'*.py'
))
+
glob
.
glob
(
join
(
directory
,
'*.pyc'
))
modules
=
set
(
basename
(
filename
).
split
(
'.'
)[
0
]
for
filename
in
modules
)
modules
=
set
(
name
for
name
in
modules
if
not
name
.
startswith
(
'_'
))
modules
=
set
(
name
for
name
in
modules
if
name
.
startswith
(
'_socket2'
)
or
name
.
startswith
(
'_socket3'
)
or
not
name
.
startswith
(
'_'
))
import
warnings
warnings
.
simplefilter
(
'ignore'
,
DeprecationWarning
)
...
...
gevent/_socket2.py
View file @
d2ee6d7e
# Copyright (c) 2009-2014 Denis Bilenko and gevent contributors. See LICENSE for details.
"""
Python 2 socket module.
"""
import
time
from
gevent
import
_socketcommon
from
gevent.hub
import
PYPY
for
key
in
_socketcommon
.
__dict__
:
if
key
.
startswith
(
'__'
):
if
key
.
startswith
(
'__'
)
or
key
in
_socketcommon
.
__py3_imports__
:
continue
globals
()[
key
]
=
getattr
(
_socketcommon
,
key
)
__socket__
=
_socketcommon
.
__socket__
__implements__
=
_socketcommon
.
_implements
__extensions__
=
_socketcommon
.
__extensions__
__imports__
=
_socketcommon
.
__imports__
__imports__
=
[
i
for
i
in
_socketcommon
.
__imports__
if
i
not
in
_socketcommon
.
__py3_imports__
]
__dns__
=
_socketcommon
.
__dns__
_fileobject
=
__socket__
.
_fileobject
try
:
_fileobject
=
__socket__
.
_fileobject
_socketmethods
=
__socket__
.
_socketmethods
except
AttributeError
:
# Allow this module to be imported under Python 3
# for building the docs
_fileobject
=
object
_socketmethods
=
(
'bind'
,
'connect'
,
'connect_ex'
,
'fileno'
,
'listen'
,
'getpeername'
,
'getsockname'
,
'getsockopt'
,
'setsockopt'
,
'sendall'
,
'setblocking'
,
'settimeout'
,
'gettimeout'
,
'shutdown'
)
if
sys
.
version_info
[:
2
]
<
(
2
,
7
):
...
...
@@ -363,7 +377,7 @@ class socket(object):
_s
=
(
"def %s(self, *args): return self._sock.%s(*args)
\
n
\
n
"
"%s.__doc__ = _realsocket.%s.__doc__
\
n
"
)
for
_m
in
set
(
_
_socket__
.
_
socketmethods
)
-
set
(
locals
()):
for
_m
in
set
(
_socketmethods
)
-
set
(
locals
()):
exec
(
_s
%
(
_m
,
_m
,
_m
,
_m
))
del
_m
,
_s
...
...
gevent/_socket3.py
View file @
d2ee6d7e
# Port of Python 3.3's socket module to gevent
"""
Python 3 socket module.
"""
import
io
import
sys
import
time
...
...
gevent/_socketcommon.py
View file @
d2ee6d7e
...
...
@@ -43,16 +43,20 @@ __imports__ = ['error',
'setdefaulttimeout'
,
# Windows:
'errorTab'
,
# Python 3
'AddressFamily'
,
'SocketKind'
,
'CMSG_LEN'
,
'CMSG_SPACE'
,
'dup'
,
'if_indextoname'
,
'if_nameindex'
,
'if_nametoindex'
,
'sethostname'
]
]
__py3_imports__
=
[
# Python 3
'AddressFamily'
,
'SocketKind'
,
'CMSG_LEN'
,
'CMSG_SPACE'
,
'dup'
,
'if_indextoname'
,
'if_nameindex'
,
'if_nametoindex'
,
'sethostname'
]
__imports__
.
extend
(
__py3_imports__
)
import
sys
...
...
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