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
0e63721d
Commit
0e63721d
authored
Mar 21, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move compat code to its own module.
parent
4daeb035
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
107 additions
and
66 deletions
+107
-66
gevent/__init__.py
gevent/__init__.py
+2
-1
gevent/_compat.py
gevent/_compat.py
+47
-0
gevent/_socket2.py
gevent/_socket2.py
+1
-1
gevent/_socketcommon.py
gevent/_socketcommon.py
+2
-1
gevent/_ssl2.py
gevent/_ssl2.py
+1
-1
gevent/_sslgte279.py
gevent/_sslgte279.py
+1
-1
gevent/_threading.py
gevent/_threading.py
+1
-1
gevent/baseserver.py
gevent/baseserver.py
+2
-1
gevent/event.py
gevent/event.py
+2
-1
gevent/fileobject.py
gevent/fileobject.py
+2
-2
gevent/greenlet.py
gevent/greenlet.py
+5
-5
gevent/hub.py
gevent/hub.py
+3
-26
gevent/local.py
gevent/local.py
+2
-1
gevent/lock.py
gevent/lock.py
+2
-1
gevent/os.py
gevent/os.py
+2
-1
gevent/pywsgi.py
gevent/pywsgi.py
+2
-1
gevent/queue.py
gevent/queue.py
+3
-4
gevent/resolver_ares.py
gevent/resolver_ares.py
+2
-1
gevent/resolver_thread.py
gevent/resolver_thread.py
+2
-1
gevent/select.py
gevent/select.py
+1
-1
gevent/server.py
gevent/server.py
+1
-1
gevent/socket.py
gevent/socket.py
+1
-1
gevent/ssl.py
gevent/ssl.py
+1
-1
gevent/subprocess.py
gevent/subprocess.py
+4
-3
gevent/thread.py
gevent/thread.py
+2
-1
gevent/threading.py
gevent/threading.py
+2
-1
gevent/threadpool.py
gevent/threadpool.py
+2
-1
gevent/timeout.py
gevent/timeout.py
+2
-1
greentest/.coveragerc
greentest/.coveragerc
+2
-1
greentest/test__all__.py
greentest/test__all__.py
+3
-1
greentest/test__pywsgi.py
greentest/test__pywsgi.py
+1
-1
greentest/test__server.py
greentest/test__server.py
+1
-1
No files found.
gevent/__init__.py
View file @
0e63721d
...
...
@@ -47,7 +47,8 @@ if sys.platform == 'win32':
import
socket
# pylint:disable=unused-import,useless-suppression
del
socket
from
gevent.hub
import
get_hub
,
iwait
,
wait
,
PYPY
from
gevent.hub
import
get_hub
,
iwait
,
wait
from
gevent._compat
import
PYPY
from
gevent.greenlet
import
Greenlet
,
joinall
,
killall
joinall
=
joinall
# export for pylint
spawn
=
Greenlet
.
spawn
...
...
gevent/_compat.py
0 → 100644
View file @
0e63721d
# -*- coding: utf-8 -*-
"""
internal gevent python 2/python 3 bridges. Not for external use.
"""
from
__future__
import
print_function
,
absolute_import
,
division
import
sys
PY2
=
sys
.
version_info
[
0
]
==
2
PY3
=
sys
.
version_info
[
0
]
>=
3
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
## Types
if
PY3
:
string_types
=
str
,
integer_types
=
int
,
text_type
=
str
else
:
import
__builtin__
# pylint:disable=import-error
string_types
=
__builtin__
.
basestring
,
text_type
=
__builtin__
.
unicode
integer_types
=
(
int
,
__builtin__
.
long
)
## Exceptions
if
PY3
:
def
reraise
(
t
,
value
,
tb
=
None
):
# pylint:disable=unused-argument
if
value
.
__traceback__
is
not
tb
:
raise
value
.
with_traceback
(
tb
)
raise
value
else
:
from
gevent._util_py2
import
reraise
# pylint:disable=import-error,no-name-in-module
reraise
=
reraise
# export
## Functions
if
PY3
:
iteritems
=
dict
.
items
xrange
=
range
else
:
iteritems
=
dict
.
iteritems
# python 3: pylint:disable=no-member
xrange
=
__builtin__
.
xrange
# python 2: pylint:disable=redefined-variable-type
gevent/_socket2.py
View file @
0e63721d
...
...
@@ -7,7 +7,7 @@ Python 2 socket module.
import
time
from
gevent
import
_socketcommon
from
gevent.
hub
import
PYPY
from
gevent.
_compat
import
PYPY
for
key
in
_socketcommon
.
__dict__
:
if
key
.
startswith
(
'__'
)
or
key
in
_socketcommon
.
__py3_imports__
or
key
in
_socketcommon
.
__extensions__
:
...
...
gevent/_socketcommon.py
View file @
0e63721d
...
...
@@ -70,9 +70,10 @@ __imports__.extend(__py3_imports__)
import
sys
from
gevent.hub
import
get_hub
,
string_types
,
integer_types
from
gevent.hub
import
get_hub
from
gevent.hub
import
ConcurrentObjectUseError
from
gevent.timeout
import
Timeout
from
gevent._compat
import
string_types
,
integer_types
is_windows
=
sys
.
platform
==
'win32'
# pylint:disable=no-name-in-module,unused-import
...
...
gevent/_ssl2.py
View file @
0e63721d
...
...
@@ -21,7 +21,7 @@ from gevent._socket2 import socket
from
gevent.socket
import
_fileobject
,
timeout_default
from
gevent.socket
import
error
as
socket_error
,
EWOULDBLOCK
from
gevent.socket
import
timeout
as
_socket_timeout
from
gevent.
hub
import
string_types
,
PYPY
from
gevent.
_compat
import
string_types
,
PYPY
try
:
long
...
...
gevent/_sslgte279.py
View file @
0e63721d
...
...
@@ -22,7 +22,7 @@ from gevent._socket2 import socket
from
gevent.socket
import
timeout_default
from
gevent.socket
import
error
as
socket_error
from
gevent.socket
import
timeout
as
_socket_timeout
from
gevent.
hub
import
PYPY
from
gevent.
_compat
import
PYPY
__implements__
=
[
'SSLContext'
,
...
...
gevent/_threading.py
View file @
0e63721d
...
...
@@ -15,7 +15,7 @@ import heapq
from
time
import
time
as
_time
,
sleep
as
_sleep
from
gevent
import
monkey
from
gevent.
hub
import
PY3
from
gevent.
_compat
import
PY3
__all__
=
[
'Condition'
,
...
...
gevent/baseserver.py
View file @
0e63721d
...
...
@@ -5,7 +5,8 @@ import _socket
import
errno
from
gevent.greenlet
import
Greenlet
from
gevent.event
import
Event
from
gevent.hub
import
string_types
,
integer_types
,
get_hub
,
xrange
from
gevent.hub
import
get_hub
from
gevent._compat
import
string_types
,
integer_types
,
xrange
__all__
=
[
'BaseServer'
]
...
...
gevent/event.py
View file @
0e63721d
...
...
@@ -2,7 +2,8 @@
"""Basic synchronization primitives: Event and AsyncResult"""
from
__future__
import
print_function
import
sys
from
gevent.hub
import
get_hub
,
getcurrent
,
_NONE
,
reraise
from
gevent.hub
import
get_hub
,
getcurrent
,
_NONE
from
gevent._compat
import
reraise
from
gevent.hub
import
InvalidSwitchError
from
gevent.timeout
import
Timeout
from
gevent._tblib
import
dump_traceback
,
load_traceback
...
...
gevent/fileobject.py
View file @
0e63721d
...
...
@@ -38,8 +38,8 @@ import sys
import
os
from
gevent._fileobjectcommon
import
FileObjectClosed
from
gevent.hub
import
get_hub
from
gevent.
hub
import
integer_types
from
gevent.
hub
import
reraise
from
gevent.
_compat
import
integer_types
from
gevent.
_compat
import
reraise
from
gevent.lock
import
Semaphore
,
DummySemaphore
...
...
gevent/greenlet.py
View file @
0e63721d
...
...
@@ -2,19 +2,19 @@
from
__future__
import
absolute_import
import
sys
from
greenlet
import
greenlet
from
gevent._compat
import
PY3
from
gevent._compat
import
PYPY
from
gevent._compat
import
reraise
from
gevent._tblib
import
dump_traceback
from
gevent._tblib
import
load_traceback
from
gevent.hub
import
GreenletExit
from
gevent.hub
import
InvalidSwitchError
from
gevent.hub
import
PY3
from
gevent.hub
import
PYPY
from
gevent.hub
import
Waiter
from
gevent.hub
import
get_hub
from
gevent.hub
import
getcurrent
from
gevent.hub
import
iwait
from
gevent.hub
import
reraise
from
gevent.hub
import
wait
from
gevent.timeout
import
Timeout
from
gevent._tblib
import
dump_traceback
from
gevent._tblib
import
load_traceback
from
collections
import
deque
...
...
gevent/hub.py
View file @
0e63721d
...
...
@@ -26,31 +26,8 @@ __all__ = [
'Waiter'
,
]
PY2
=
sys
.
version_info
[
0
]
==
2
PY3
=
sys
.
version_info
[
0
]
>=
3
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
if
PY3
:
string_types
=
str
,
integer_types
=
int
,
text_type
=
str
xrange
=
range
def
reraise
(
t
,
value
,
tb
=
None
):
# pylint:disable=unused-argument
if
value
.
__traceback__
is
not
tb
:
raise
value
.
with_traceback
(
tb
)
raise
value
else
:
import
__builtin__
# pylint:disable=import-error
string_types
=
__builtin__
.
basestring
,
text_type
=
__builtin__
.
unicode
integer_types
=
(
int
,
__builtin__
.
long
)
xrange
=
__builtin__
.
xrange
# python 2: pylint:disable=redefined-variable-type
from
gevent._util_py2
import
reraise
# pylint:disable=import-error,unused-import,no-name-in-module
from
gevent._compat
import
string_types
from
gevent._compat
import
xrange
if
sys
.
version_info
[
0
]
<=
2
:
import
thread
# pylint:disable=import-error
...
...
@@ -447,7 +424,7 @@ def _import(path):
def
config
(
default
,
envvar
):
result
=
os
.
environ
.
get
(
envvar
)
or
default
result
=
os
.
environ
.
get
(
envvar
)
or
default
# absolute import gets confused pylint: disable=no-member
if
isinstance
(
result
,
string_types
):
return
result
.
split
(
','
)
return
result
...
...
gevent/local.py
View file @
0e63721d
...
...
@@ -138,7 +138,8 @@ affects what we see:
from
copy
import
copy
from
weakref
import
ref
from
contextlib
import
contextmanager
from
gevent.hub
import
getcurrent
,
PYPY
from
gevent.hub
import
getcurrent
from
gevent._compat
import
PYPY
from
gevent.lock
import
RLock
__all__
=
[
"local"
]
...
...
gevent/lock.py
View file @
0e63721d
...
...
@@ -2,7 +2,8 @@
"""Locking primitives"""
from
__future__
import
absolute_import
from
gevent.hub
import
getcurrent
,
PYPY
from
gevent.hub
import
getcurrent
from
gevent._compat
import
PYPY
from
gevent._semaphore
import
Semaphore
,
BoundedSemaphore
# pylint:disable=no-name-in-module,import-error
...
...
gevent/os.py
View file @
0e63721d
...
...
@@ -45,7 +45,8 @@ from __future__ import absolute_import
import
os
import
sys
from
gevent.hub
import
get_hub
,
reinit
,
PY3
from
gevent.hub
import
get_hub
,
reinit
from
gevent._compat
import
PY3
import
errno
EAGAIN
=
getattr
(
errno
,
'EAGAIN'
,
11
)
...
...
gevent/pywsgi.py
View file @
0e63721d
...
...
@@ -28,7 +28,8 @@ except ImportError:
from
gevent
import
socket
import
gevent
from
gevent.server
import
StreamServer
from
gevent.hub
import
GreenletExit
,
PY3
,
reraise
from
gevent.hub
import
GreenletExit
from
gevent._compat
import
PY3
,
reraise
from
functools
import
partial
if
PY3
:
...
...
gevent/queue.py
View file @
0e63721d
...
...
@@ -35,7 +35,7 @@ Full = __queue__.Full
Empty
=
__queue__
.
Empty
from
gevent.timeout
import
Timeout
from
gevent.hub
import
get_hub
,
Waiter
,
getcurrent
,
PY3
from
gevent.hub
import
get_hub
,
Waiter
,
getcurrent
from
gevent.hub
import
InvalidSwitchError
...
...
@@ -347,9 +347,8 @@ class Queue(object):
raise
result
return
result
if
PY3
:
__next__
=
next
del
next
class
ItemWaiter
(
Waiter
):
...
...
gevent/resolver_ares.py
View file @
0e63721d
...
...
@@ -6,7 +6,8 @@ from __future__ import absolute_import
import
os
import
sys
from
_socket
import
getservbyname
,
getaddrinfo
,
gaierror
,
error
from
gevent.hub
import
Waiter
,
get_hub
,
string_types
,
text_type
,
integer_types
,
reraise
,
PY3
from
gevent.hub
import
Waiter
,
get_hub
from
gevent._compat
import
string_types
,
text_type
,
integer_types
,
reraise
,
PY3
from
gevent.socket
import
AF_UNSPEC
,
AF_INET
,
AF_INET6
,
SOCK_STREAM
,
SOCK_DGRAM
,
SOCK_RAW
,
AI_NUMERICHOST
,
EAI_SERVICE
,
AI_PASSIVE
from
gevent.ares
import
channel
,
InvalidIP
# pylint:disable=import-error,no-name-in-module
...
...
gevent/resolver_thread.py
View file @
0e63721d
...
...
@@ -3,7 +3,8 @@
Native thread-based hostname resolver.
"""
import
_socket
from
gevent.hub
import
get_hub
,
text_type
from
gevent._compat
import
text_type
from
gevent.hub
import
get_hub
__all__
=
[
'Resolver'
]
...
...
gevent/select.py
View file @
0e63721d
...
...
@@ -5,7 +5,7 @@ Waiting for I/O completion.
from
__future__
import
absolute_import
from
gevent.event
import
Event
from
gevent.hub
import
get_hub
from
gevent.
hub
import
integer_types
from
gevent.
_compat
import
integer_types
try
:
...
...
gevent/server.py
View file @
0e63721d
...
...
@@ -4,7 +4,7 @@ import sys
import
_socket
from
gevent.baseserver
import
BaseServer
from
gevent.socket
import
EWOULDBLOCK
,
socket
from
gevent.
hub
import
PYPY
,
PY3
from
gevent.
_compat
import
PYPY
,
PY3
__all__
=
[
'StreamServer'
,
'DatagramServer'
]
...
...
gevent/socket.py
View file @
0e63721d
...
...
@@ -14,7 +14,7 @@ as well as the constants from the :mod:`socket` module are imported into this mo
# pylint: disable=undefined-variable
import
sys
from
gevent.
hub
import
PY3
from
gevent.
_compat
import
PY3
if
PY3
:
...
...
gevent/ssl.py
View file @
0e63721d
"""
Secure Sockets Layer (SSL/TLS) module.
"""
from
gevent.
hub
import
PY2
from
gevent.
_compat
import
PY2
if
PY2
:
...
...
gevent/subprocess.py
View file @
0e63721d
...
...
@@ -38,9 +38,10 @@ import signal
import
sys
import
traceback
from
gevent.event
import
AsyncResult
from
gevent.hub
import
get_hub
,
linkproxy
,
sleep
,
getcurrent
,
integer_types
,
string_types
,
xrange
from
gevent.hub
import
PY3
from
gevent.hub
import
reraise
from
gevent.hub
import
get_hub
,
linkproxy
,
sleep
,
getcurrent
from
gevent._compat
import
integer_types
,
string_types
,
xrange
from
gevent._compat
import
PY3
from
gevent._compat
import
reraise
from
gevent.fileobject
import
FileObject
from
gevent.greenlet
import
Greenlet
,
joinall
spawn
=
Greenlet
.
spawn
...
...
gevent/thread.py
View file @
0e63721d
...
...
@@ -30,7 +30,8 @@ else:
'interrupt_main'
,
'start_new'
]
error
=
__thread__
.
error
from
gevent.hub
import
getcurrent
,
GreenletExit
,
PY3
from
gevent._compat
import
PY3
from
gevent.hub
import
getcurrent
,
GreenletExit
from
gevent.greenlet
import
Greenlet
from
gevent.lock
import
BoundedSemaphore
from
gevent.local
import
local
as
_local
...
...
gevent/threading.py
View file @
0e63721d
...
...
@@ -16,7 +16,8 @@ import threading as __threading__
_DummyThread_
=
__threading__
.
_DummyThread
from
gevent.local
import
local
from
gevent.thread
import
start_new_thread
as
_start_new_thread
,
allocate_lock
as
_allocate_lock
,
get_ident
as
_get_ident
from
gevent.hub
import
sleep
as
_sleep
,
getcurrent
,
PYPY
from
gevent._compat
import
PYPY
from
gevent.hub
import
sleep
as
_sleep
,
getcurrent
# Exports, prevent unused import warnings
local
=
local
...
...
gevent/threadpool.py
View file @
0e63721d
...
...
@@ -2,7 +2,8 @@
from
__future__
import
absolute_import
import
sys
import
os
from
gevent.hub
import
get_hub
,
getcurrent
,
sleep
,
integer_types
from
gevent._compat
import
integer_types
from
gevent.hub
import
get_hub
,
getcurrent
,
sleep
from
gevent.event
import
AsyncResult
from
gevent.greenlet
import
Greenlet
from
gevent.pool
import
GroupMappingMixin
...
...
gevent/timeout.py
View file @
0e63721d
...
...
@@ -14,7 +14,8 @@ module add timeouts to arbitrary code.
which no switches occur, :class:`Timeout` is powerless.
"""
from
gevent.hub
import
getcurrent
,
_NONE
,
get_hub
,
string_types
from
gevent._compat
import
string_types
from
gevent.hub
import
getcurrent
,
_NONE
,
get_hub
__all__
=
[
'Timeout'
,
'with_timeout'
]
...
...
greentest/.coveragerc
View file @
0e63721d
...
...
@@ -23,4 +23,5 @@ exclude_lines =
if PY3:
if sys.platform == 'win32':
if mswindows:
if is_windows:
if sys.version_info.*>=.*3
greentest/test__all__.py
View file @
0e63721d
...
...
@@ -43,7 +43,9 @@ COULD_BE_MISSING = {
'subprocess'
:
[
'_posixsubprocess'
],
}
NO_ALL
=
[
'gevent.threading'
,
'gevent._util'
,
NO_ALL
=
[
'gevent.threading'
,
'gevent._util'
,
'gevent._compat'
,
'gevent._socketcommon'
,
'gevent._fileobjectcommon'
,
'gevent._fileobjectposix'
,
'gevent._tblib'
,
...
...
greentest/test__pywsgi.py
View file @
0e63721d
...
...
@@ -47,7 +47,7 @@ except ImportError:
import
greentest
import
gevent
from
g
event.hub
import
PY3
,
PYPY
from
g
reentest
import
PY3
,
PYPY
from
gevent
import
socket
from
gevent
import
pywsgi
from
gevent.pywsgi
import
Input
...
...
greentest/test__server.py
View file @
0e63721d
from
__future__
import
print_function
import
greentest
from
g
event.hub
import
PY3
from
g
reentest
import
PY3
from
gevent
import
socket
import
gevent
from
gevent.server
import
StreamServer
...
...
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