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
2832922f
Commit
2832922f
authored
Jul 07, 2021
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for new pylint.
parent
3be12a03
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
69 additions
and
49 deletions
+69
-49
.github/workflows/ci.yml
.github/workflows/ci.yml
+1
-1
src/gevent/_compat.py
src/gevent/_compat.py
+1
-1
src/gevent/_ffi/loop.py
src/gevent/_ffi/loop.py
+1
-1
src/gevent/_monitor.py
src/gevent/_monitor.py
+1
-1
src/gevent/_ssl2.py
src/gevent/_ssl2.py
+3
-1
src/gevent/_ssl3.py
src/gevent/_ssl3.py
+6
-6
src/gevent/_sslgte279.py
src/gevent/_sslgte279.py
+2
-2
src/gevent/contextvars.py
src/gevent/contextvars.py
+1
-1
src/gevent/libev/corecffi.py
src/gevent/libev/corecffi.py
+2
-1
src/gevent/libev/watcher.py
src/gevent/libev/watcher.py
+1
-0
src/gevent/libuv/loop.py
src/gevent/libuv/loop.py
+0
-5
src/gevent/resolver/__init__.py
src/gevent/resolver/__init__.py
+1
-1
src/gevent/resolver/ares.py
src/gevent/resolver/ares.py
+2
-0
src/gevent/testing/monkey_test.py
src/gevent/testing/monkey_test.py
+3
-2
src/gevent/testing/testcase.py
src/gevent/testing/testcase.py
+2
-1
src/gevent/tests/lock_tests.py
src/gevent/tests/lock_tests.py
+1
-0
src/gevent/tests/monkey_package/issue1526_no_monkey.py
src/gevent/tests/monkey_package/issue1526_no_monkey.py
+1
-1
src/gevent/tests/test___monitor.py
src/gevent/tests/test___monitor.py
+2
-2
src/gevent/tests/test__contextvars.py
src/gevent/tests/test__contextvars.py
+2
-4
src/gevent/tests/test__environ.py
src/gevent/tests/test__environ.py
+1
-0
src/gevent/tests/test__example_wsgiserver.py
src/gevent/tests/test__example_wsgiserver.py
+1
-1
src/gevent/tests/test__getaddrinfo_import.py
src/gevent/tests/test__getaddrinfo_import.py
+1
-1
src/gevent/tests/test__import_wait.py
src/gevent/tests/test__import_wait.py
+1
-1
src/gevent/tests/test__issue6.py
src/gevent/tests/test__issue6.py
+1
-0
src/gevent/tests/test__issue600.py
src/gevent/tests/test__issue600.py
+1
-1
src/gevent/tests/test__issues461_471.py
src/gevent/tests/test__issues461_471.py
+1
-0
src/gevent/tests/test__local.py
src/gevent/tests/test__local.py
+3
-3
src/gevent/tests/test__makefile_ref.py
src/gevent/tests/test__makefile_ref.py
+2
-0
src/gevent/tests/test__monkey.py
src/gevent/tests/test__monkey.py
+2
-2
src/gevent/tests/test__monkey_sigchld_3.py
src/gevent/tests/test__monkey_sigchld_3.py
+1
-0
src/gevent/tests/test__pywsgi.py
src/gevent/tests/test__pywsgi.py
+6
-6
src/gevent/tests/test__refcount.py
src/gevent/tests/test__refcount.py
+1
-1
src/gevent/tests/test__socket.py
src/gevent/tests/test__socket.py
+3
-0
src/gevent/tests/test__ssl.py
src/gevent/tests/test__ssl.py
+5
-1
src/gevent/tests/test__subprocess_interrupted.py
src/gevent/tests/test__subprocess_interrupted.py
+1
-0
src/gevent/tests/test__threading.py
src/gevent/tests/test__threading.py
+1
-0
src/gevent/tests/test__threading_2.py
src/gevent/tests/test__threading_2.py
+2
-0
src/gevent/threading.py
src/gevent/threading.py
+1
-0
src/gevent/threadpool.py
src/gevent/threadpool.py
+1
-1
No files found.
.github/workflows/ci.yml
View file @
2832922f
...
@@ -288,7 +288,7 @@ jobs:
...
@@ -288,7 +288,7 @@ jobs:
# TODO: Revisit this when we have caching of that part.
# TODO: Revisit this when we have caching of that part.
run
:
|
run
:
|
pip install -U pylint
pip install -U pylint
python -m pylint --
limit-inference-results=1 --
rcfile=.pylintrc gevent
python -m pylint --rcfile=.pylintrc gevent
-
name
:
"
Tests:
Basic"
-
name
:
"
Tests:
Basic"
run
:
|
run
:
|
python -m gevent.tests --second-chance $G_USE_COV
python -m gevent.tests --second-chance $G_USE_COV
...
...
src/gevent/_compat.py
View file @
2832922f
...
@@ -80,7 +80,7 @@ try:
...
@@ -80,7 +80,7 @@ try:
# deprecated. Avoid that warning.
# deprecated. Avoid that warning.
import
_imp
as
imp
import
_imp
as
imp
except
ImportError
:
except
ImportError
:
import
imp
import
imp
# pylint:disable=deprecated-module
imp_acquire_lock
=
imp
.
acquire_lock
imp_acquire_lock
=
imp
.
acquire_lock
imp_release_lock
=
imp
.
release_lock
imp_release_lock
=
imp
.
release_lock
...
...
src/gevent/_ffi/loop.py
View file @
2832922f
...
@@ -332,7 +332,7 @@ def assign_standard_callbacks(ffi, lib, callbacks_class, extras=()): # pylint:di
...
@@ -332,7 +332,7 @@ def assign_standard_callbacks(ffi, lib, callbacks_class, extras=()): # pylint:di
# callbacks keeps these cdata objects alive at the python level
# callbacks keeps these cdata objects alive at the python level
callbacks
=
callbacks_class
(
ffi
)
callbacks
=
callbacks_class
(
ffi
)
extras
=
[
extra
if
len
(
extra
)
==
2
else
(
extra
,
None
)
for
extra
in
extras
]
extras
=
[
extra
if
len
(
extra
)
==
2
else
(
extra
,
None
)
for
extra
in
extras
]
extras
=
tuple
(
[(
getattr
(
callbacks
,
name
),
error
)
for
name
,
error
in
extras
]
)
extras
=
tuple
(
(
getattr
(
callbacks
,
name
),
error
)
for
name
,
error
in
extras
)
for
(
func
,
error_func
)
in
(
for
(
func
,
error_func
)
in
(
(
callbacks
.
python_callback
,
None
),
(
callbacks
.
python_callback
,
None
),
(
callbacks
.
python_handle_error
,
None
),
(
callbacks
.
python_handle_error
,
None
),
...
...
src/gevent/_monitor.py
View file @
2832922f
...
@@ -230,7 +230,7 @@ class PeriodicMonitoringThread(object):
...
@@ -230,7 +230,7 @@ class PeriodicMonitoringThread(object):
if
not
did_block
:
if
not
did_block
:
return
return
active_greenlet
=
did_block
[
1
]
active_greenlet
=
did_block
[
1
]
# pylint:disable=unsubscriptable-object
report
=
self
.
_greenlet_tracer
.
did_block_hub_report
(
report
=
self
.
_greenlet_tracer
.
did_block_hub_report
(
hub
,
active_greenlet
,
hub
,
active_greenlet
,
dict
(
greenlet_stacks
=
False
,
current_thread_ident
=
self
.
monitor_thread_ident
))
dict
(
greenlet_stacks
=
False
,
current_thread_ident
=
self
.
monitor_thread_ident
))
...
...
src/gevent/_ssl2.py
View file @
2832922f
# (No idea where this comes from; it warns about 'configuration')
# pylint:disable=invalid-all-format
# Wrapper module for _ssl. Written by Bill Janssen.
# Wrapper module for _ssl. Written by Bill Janssen.
# Ported to gevent by Denis Bilenko.
# Ported to gevent by Denis Bilenko.
"""
"""
...
@@ -324,7 +326,7 @@ class SSLSocket(socket):
...
@@ -324,7 +326,7 @@ class SSLSocket(socket):
else
:
else
:
raise
raise
def
connect
(
self
,
addr
):
def
connect
(
self
,
addr
):
# renamed addr -> address in Python 3 pylint:disable=arguments-renamed
"""Connects to remote ADDR, and then wraps the connection in
"""Connects to remote ADDR, and then wraps the connection in
an SSL channel."""
an SSL channel."""
# Here we assume that the socket is client-side, and not
# Here we assume that the socket is client-side, and not
...
...
src/gevent/_ssl3.py
View file @
2832922f
...
@@ -186,13 +186,13 @@ class SSLContext(orig_SSLContext):
...
@@ -186,13 +186,13 @@ class SSLContext(orig_SSLContext):
def
sni_callback
(
self
,
value
):
def
sni_callback
(
self
,
value
):
if
value
and
callable
(
value
):
if
value
and
callable
(
value
):
value
=
_Callback
(
value
)
value
=
_Callback
(
value
)
super
(
orig_SSLContext
,
orig_SSLContext
).
sni_callback
.
__set__
(
self
,
value
)
super
(
orig_SSLContext
,
orig_SSLContext
).
sni_callback
.
__set__
(
self
,
value
)
# pylint:disable=no-member
else
:
else
:
# In newer versions, this just sets sni_callback.
# In newer versions, this just sets sni_callback.
def
set_servername_callback
(
self
,
cb
):
# pylint:disable=arguments-differ
def
set_servername_callback
(
self
,
server_name_callback
):
if
cb
and
callable
(
cb
):
if
server_name_callback
and
callable
(
server_name_callback
):
cb
=
_Callback
(
cb
)
server_name_callback
=
_Callback
(
server_name_callback
)
super
().
set_servername_callback
(
cb
)
super
().
set_servername_callback
(
server_name_callback
)
class
SSLSocket
(
socket
):
class
SSLSocket
(
socket
):
...
@@ -681,7 +681,7 @@ class SSLSocket(socket):
...
@@ -681,7 +681,7 @@ class SSLSocket(socket):
if
not
self
.
server_hostname
:
if
not
self
.
server_hostname
:
raise
ValueError
(
"check_hostname needs server_hostname "
raise
ValueError
(
"check_hostname needs server_hostname "
"argument"
)
"argument"
)
match_hostname
(
self
.
getpeercert
(),
self
.
server_hostname
)
match_hostname
(
self
.
getpeercert
(),
self
.
server_hostname
)
# pylint:disable=deprecated-method
if
hasattr
(
SSLObject
,
'_create'
):
if
hasattr
(
SSLObject
,
'_create'
):
# 3.7+, making it difficult to create these objects.
# 3.7+, making it difficult to create these objects.
...
...
src/gevent/_sslgte279.py
View file @
2832922f
...
@@ -629,12 +629,12 @@ class SSLSocket(socket):
...
@@ -629,12 +629,12 @@ class SSLSocket(socket):
self
.
_sslobj
=
None
self
.
_sslobj
=
None
raise
raise
def
connect
(
self
,
addr
):
def
connect
(
self
,
addr
):
# pylint:disable=arguments-renamed
"""Connects to remote ADDR, and then wraps the connection in
"""Connects to remote ADDR, and then wraps the connection in
an SSL channel."""
an SSL channel."""
self
.
_real_connect
(
addr
,
False
)
self
.
_real_connect
(
addr
,
False
)
def
connect_ex
(
self
,
addr
):
def
connect_ex
(
self
,
addr
):
# pylint:disable=arguments-renamed
"""Connects to remote ADDR, and then wraps the connection in
"""Connects to remote ADDR, and then wraps the connection in
an SSL channel."""
an SSL channel."""
return
self
.
_real_connect
(
addr
,
True
)
return
self
.
_real_connect
(
addr
,
True
)
...
...
src/gevent/contextvars.py
View file @
2832922f
...
@@ -51,7 +51,7 @@ __all__ = [
...
@@ -51,7 +51,7 @@ __all__ = [
try
:
try
:
from
collections.abc
import
Mapping
from
collections.abc
import
Mapping
except
ImportError
:
except
ImportError
:
from
collections
import
Mapping
from
collections
import
Mapping
# pylint:disable=deprecated-class
from
gevent._compat
import
PY37
from
gevent._compat
import
PY37
from
gevent._util
import
_NONE
from
gevent._util
import
_NONE
...
...
src/gevent/libev/corecffi.py
View file @
2832922f
...
@@ -25,6 +25,7 @@ libev = _corecffi.lib # pylint:disable=no-member
...
@@ -25,6 +25,7 @@ libev = _corecffi.lib # pylint:disable=no-member
if
hasattr
(
libev
,
'vfd_open'
):
if
hasattr
(
libev
,
'vfd_open'
):
# Must be on windows
# Must be on windows
# pylint:disable=c-extension-no-member
assert
sys
.
platform
.
startswith
(
"win"
),
"vfd functions only needed on windows"
assert
sys
.
platform
.
startswith
(
"win"
),
"vfd functions only needed on windows"
vfd_open
=
libev
.
vfd_open
vfd_open
=
libev
.
vfd_open
vfd_free
=
libev
.
vfd_free
vfd_free
=
libev
.
vfd_free
...
@@ -52,7 +53,7 @@ from gevent._ffi.loop import AbstractCallbacks
...
@@ -52,7 +53,7 @@ from gevent._ffi.loop import AbstractCallbacks
from
gevent._ffi.loop
import
assign_standard_callbacks
from
gevent._ffi.loop
import
assign_standard_callbacks
class
_Callbacks
(
AbstractCallbacks
):
class
_Callbacks
(
AbstractCallbacks
):
# pylint:disable=arguments-differ
# pylint:disable=arguments-differ
,arguments-renamed
def
python_check_callback
(
self
,
_loop
,
watcher_ptr
,
_events
):
def
python_check_callback
(
self
,
_loop
,
watcher_ptr
,
_events
):
pass
pass
...
...
src/gevent/libev/watcher.py
View file @
2832922f
...
@@ -14,6 +14,7 @@ libev = _corecffi.lib # pylint:disable=no-member
...
@@ -14,6 +14,7 @@ libev = _corecffi.lib # pylint:disable=no-member
if
hasattr
(
libev
,
'vfd_open'
):
if
hasattr
(
libev
,
'vfd_open'
):
# Must be on windows
# Must be on windows
# pylint:disable=c-extension-no-member
assert
sys
.
platform
.
startswith
(
"win"
),
"vfd functions only needed on windows"
assert
sys
.
platform
.
startswith
(
"win"
),
"vfd functions only needed on windows"
vfd_open
=
libev
.
vfd_open
vfd_open
=
libev
.
vfd_open
vfd_free
=
libev
.
vfd_free
vfd_free
=
libev
.
vfd_free
...
...
src/gevent/libuv/loop.py
View file @
2832922f
...
@@ -47,10 +47,6 @@ class _Callbacks(AbstractCallbacks):
...
@@ -47,10 +47,6 @@ class _Callbacks(AbstractCallbacks):
the_watcher
.
loop
.
_queue_callback
(
watcher_ptr
,
revents
)
the_watcher
.
loop
.
_queue_callback
(
watcher_ptr
,
revents
)
def
__loop_from_loop_ptr
(
self
,
loop_ptr
):
loop_handle
=
loop_ptr
.
data
return
self
.
from_handle
(
loop_handle
)
_callbacks
=
assign_standard_callbacks
(
_callbacks
=
assign_standard_callbacks
(
ffi
,
libuv
,
_Callbacks
,
ffi
,
libuv
,
_Callbacks
,
...
@@ -116,7 +112,6 @@ class loop(AbstractLoop):
...
@@ -116,7 +112,6 @@ class loop(AbstractLoop):
def
__init__
(
self
,
flags
=
None
,
default
=
None
):
def
__init__
(
self
,
flags
=
None
,
default
=
None
):
AbstractLoop
.
__init__
(
self
,
ffi
,
libuv
,
_watchers
,
flags
,
default
)
AbstractLoop
.
__init__
(
self
,
ffi
,
libuv
,
_watchers
,
flags
,
default
)
self
.
__loop_pid
=
os
.
getpid
()
self
.
_child_watchers
=
defaultdict
(
list
)
self
.
_child_watchers
=
defaultdict
(
list
)
self
.
_io_watchers
=
dict
()
self
.
_io_watchers
=
dict
()
self
.
_fork_watchers
=
set
()
self
.
_fork_watchers
=
set
()
...
...
src/gevent/resolver/__init__.py
View file @
2832922f
...
@@ -164,7 +164,7 @@ class AbstractResolver(object):
...
@@ -164,7 +164,7 @@ class AbstractResolver(object):
# behaviour with special names. Notably, ``gethostbyname`` will handle
# behaviour with special names. Notably, ``gethostbyname`` will handle
# both "<broadcast>" and "255.255.255.255", while ``gethostbyname_ex`` refuses to
# both "<broadcast>" and "255.255.255.255", while ``gethostbyname_ex`` refuses to
# handle those; they result in different errors, too. So we can't
# handle those; they result in different errors, too. So we can't
# pass those throgh.
# pass those thro
u
gh.
hostname
=
self
.
_hostname_to_bytes
(
hostname
)
hostname
=
self
.
_hostname_to_bytes
(
hostname
)
if
hostname
in
self
.
_LOCAL_AND_BROADCAST_HOSTNAMES
:
if
hostname
in
self
.
_LOCAL_AND_BROADCAST_HOSTNAMES
:
return
native_gethostbyname
(
hostname
)
return
native_gethostbyname
(
hostname
)
...
...
src/gevent/resolver/ares.py
View file @
2832922f
...
@@ -242,6 +242,7 @@ class Resolver(AbstractResolver):
...
@@ -242,6 +242,7 @@ class Resolver(AbstractResolver):
(
SOCK_DGRAM
,
SOL_UDP
),
(
SOCK_DGRAM
,
SOL_UDP
),
]
]
# pylint:disable=not-an-iterable,unsubscriptable-object
result
=
[
result
=
[
(
rfamily
,
(
rfamily
,
hard_type
if
not
rtype
else
rtype
,
hard_type
if
not
rtype
else
rtype
,
...
@@ -275,6 +276,7 @@ class Resolver(AbstractResolver):
...
@@ -275,6 +276,7 @@ class Resolver(AbstractResolver):
proto
=
0
,
flags
=
0
)
proto
=
0
,
flags
=
0
)
if
not
result
:
if
not
result
:
raise
raise
# pylint:disable=unsubscriptable-object
_ip_address
=
result
[
0
][
-
1
][
0
]
_ip_address
=
result
[
0
][
-
1
][
0
]
if
isinstance
(
_ip_address
,
text_type
):
if
isinstance
(
_ip_address
,
text_type
):
_ip_address
=
_ip_address
.
encode
(
'ascii'
)
_ip_address
=
_ip_address
.
encode
(
'ascii'
)
...
...
src/gevent/testing/monkey_test.py
View file @
2832922f
...
@@ -70,10 +70,11 @@ test_name = os.path.splitext(test_filename)[0]
...
@@ -70,10 +70,11 @@ test_name = os.path.splitext(test_filename)[0]
# string. Passing unicode to `compile` on Python 2 can
# string. Passing unicode to `compile` on Python 2 can
# do bad things: it conflicts with a 'coding:' directive,
# do bad things: it conflicts with a 'coding:' directive,
# and it can cause some TypeError with string literals
# and it can cause some TypeError with string literals
# We do use with; just not on the same line!
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
module_file
=
open
(
test_filename
,
encoding
=
'utf-8'
)
module_file
=
open
(
test_filename
,
encoding
=
'utf-8'
)
# pylint:disable=consider-using-with
else
:
else
:
module_file
=
open
(
test_filename
)
module_file
=
open
(
test_filename
)
# pylint:disable=consider-using-with
with
module_file
:
with
module_file
:
module_source
=
module_file
.
read
()
module_source
=
module_file
.
read
()
module_source
=
disable_tests_in_source
(
module_source
,
test_name
)
module_source
=
disable_tests_in_source
(
module_source
,
test_name
)
...
...
src/gevent/testing/testcase.py
View file @
2832922f
...
@@ -274,7 +274,8 @@ class TestCase(TestCaseMetaClass("NewBase",
...
@@ -274,7 +274,8 @@ class TestCase(TestCaseMetaClass("NewBase",
error_fatal
=
True
error_fatal
=
True
uses_handle_error
=
True
uses_handle_error
=
True
close_on_teardown
=
()
close_on_teardown
=
()
__old_subscribers
=
()
# This is really used by the SubscriberCleanupMixin
__old_subscribers
=
()
# pylint:disable=unused-private-member
def
run
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=signature-differs
def
run
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=signature-differs
if
self
.
switch_expected
==
'default'
:
if
self
.
switch_expected
==
'default'
:
...
...
src/gevent/tests/lock_tests.py
View file @
2832922f
...
@@ -327,6 +327,7 @@ class ConditionTests(BaseTestCase):
...
@@ -327,6 +327,7 @@ class ConditionTests(BaseTestCase):
cond
=
self
.
condtype
()
cond
=
self
.
condtype
()
# Be default we have an RLock: the condition can be acquired multiple
# Be default we have an RLock: the condition can be acquired multiple
# times.
# times.
# pylint:disable=consider-using-with
cond
.
acquire
()
cond
.
acquire
()
cond
.
acquire
()
cond
.
acquire
()
cond
.
release
()
cond
.
release
()
...
...
src/gevent/tests/monkey_package/issue1526_no_monkey.py
View file @
2832922f
...
@@ -9,7 +9,7 @@ from __future__ import absolute_import
...
@@ -9,7 +9,7 @@ from __future__ import absolute_import
import
dns
import
dns
assert
dns
assert
dns
import
gevent.socket
as
socket
import
gevent.socket
as
socket
# pylint:disable=consider-using-from-import
socket
.
getfqdn
()
# create the resolver
socket
.
getfqdn
()
# create the resolver
from
gevent.resolver.dnspython
import
dns
as
gdns
from
gevent.resolver.dnspython
import
dns
as
gdns
...
...
src/gevent/tests/test___monitor.py
View file @
2832922f
...
@@ -341,8 +341,8 @@ class TestPeriodicMonitorMemory(_AbstractTestPeriodicMonitoringThread,
...
@@ -341,8 +341,8 @@ class TestPeriodicMonitorMemory(_AbstractTestPeriodicMonitoringThread,
event
=
self
.
pmt
.
monitor_memory_usage
(
None
)
event
=
self
.
pmt
.
monitor_memory_usage
(
None
)
self
.
assertIsInstance
(
event
,
events
.
MemoryUsageThresholdExceeded
)
self
.
assertIsInstance
(
event
,
events
.
MemoryUsageThresholdExceeded
)
self
.
assertEqual
(
2
,
event
.
mem_usage
)
self
.
assertEqual
(
2
,
event
.
mem_usage
)
self
.
assertEqual
(
1
,
event
.
max_allowed
)
self
.
assertEqual
(
1
,
event
.
max_allowed
)
# pylint:disable=no-member
self
.
assertIsInstance
(
event
.
memory_info
,
MockProcess
)
self
.
assertIsInstance
(
event
.
memory_info
,
MockProcess
)
# pylint:disable=no-member
# No growth, no event
# No growth, no event
event
=
self
.
pmt
.
monitor_memory_usage
(
None
)
event
=
self
.
pmt
.
monitor_memory_usage
(
None
)
...
...
src/gevent/tests/test__contextvars.py
View file @
2832922f
...
@@ -370,11 +370,9 @@ class ContextTest(unittest.TestCase):
...
@@ -370,11 +370,9 @@ class ContextTest(unittest.TestCase):
self
.
assertEqual
(
cvar
.
get
(),
num
+
i
)
self
.
assertEqual
(
cvar
.
get
(),
num
+
i
)
return
num
return
num
tp
=
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
10
)
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
10
)
as
tp
:
try
:
results
=
list
(
tp
.
map
(
sub
,
range
(
10
)))
results
=
list
(
tp
.
map
(
sub
,
range
(
10
)))
finally
:
tp
.
shutdown
()
self
.
assertEqual
(
results
,
list
(
range
(
10
)))
self
.
assertEqual
(
results
,
list
(
range
(
10
)))
# gevent: clases's can't be subscripted on Python 3.6
# gevent: clases's can't be subscripted on Python 3.6
...
...
src/gevent/tests/test__environ.py
View file @
2832922f
...
@@ -6,6 +6,7 @@ import subprocess
...
@@ -6,6 +6,7 @@ import subprocess
if
sys
.
argv
[
1
:]
==
[]:
if
sys
.
argv
[
1
:]
==
[]:
os
.
environ
[
'GEVENT_BACKEND'
]
=
'select'
os
.
environ
[
'GEVENT_BACKEND'
]
=
'select'
# (not in Py2) pylint:disable=consider-using-with
popen
=
subprocess
.
Popen
([
sys
.
executable
,
__file__
,
'1'
])
popen
=
subprocess
.
Popen
([
sys
.
executable
,
__file__
,
'1'
])
assert
popen
.
wait
()
==
0
,
popen
.
poll
()
assert
popen
.
wait
()
==
0
,
popen
.
poll
()
else
:
# pragma: no cover
else
:
# pragma: no cover
...
...
src/gevent/tests/test__example_wsgiserver.py
View file @
2832922f
...
@@ -62,7 +62,7 @@ class Test_wsgiserver(util.TestServer):
...
@@ -62,7 +62,7 @@ class Test_wsgiserver(util.TestServer):
sock
=
socket
.
create_connection
((
params
.
DEFAULT_LOCAL_HOST_ADDR
,
self
.
PORT
))
sock
=
socket
.
create_connection
((
params
.
DEFAULT_LOCAL_HOST_ADDR
,
self
.
PORT
))
ssl_sock
=
None
ssl_sock
=
None
if
self
.
_use_ssl
:
if
self
.
_use_ssl
:
ssl_sock
=
ssl
.
wrap_socket
(
sock
)
ssl_sock
=
ssl
.
wrap_socket
(
sock
)
# pylint:disable=deprecated-method
sock_file
=
ssl_sock
.
makefile
(
mode
=
'rwb'
)
sock_file
=
ssl_sock
.
makefile
(
mode
=
'rwb'
)
else
:
else
:
sock_file
=
sock
.
makefile
(
mode
=
'rwb'
)
sock_file
=
sock
.
makefile
(
mode
=
'rwb'
)
...
...
src/gevent/tests/test__getaddrinfo_import.py
View file @
2832922f
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
# attempts to import encodings.idna but blocks on the import lock. Verify
# attempts to import encodings.idna but blocks on the import lock. Verify
# that gevent avoids this deadlock.
# that gevent avoids this deadlock.
import
getaddrinfo_module
import
getaddrinfo_module
# pylint:disable=import-error
del
getaddrinfo_module
# fix pyflakes
del
getaddrinfo_module
# fix pyflakes
src/gevent/tests/test__import_wait.py
View file @
2832922f
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
from
gevent
import
monkey
from
gevent
import
monkey
monkey
.
patch_all
()
monkey
.
patch_all
()
import
_import_wait
import
_import_wait
# pylint:disable=import-error
assert
_import_wait
.
x
assert
_import_wait
.
x
src/gevent/tests/test__issue6.py
View file @
2832922f
...
@@ -6,6 +6,7 @@ import sys
...
@@ -6,6 +6,7 @@ import sys
if
not
sys
.
argv
[
1
:]:
if
not
sys
.
argv
[
1
:]:
from
subprocess
import
Popen
,
PIPE
from
subprocess
import
Popen
,
PIPE
# not on Py2 pylint:disable=consider-using-with
p
=
Popen
([
sys
.
executable
,
__file__
,
'subprocess'
],
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
)
p
=
Popen
([
sys
.
executable
,
__file__
,
'subprocess'
],
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
)
out
,
err
=
p
.
communicate
(
b'hello world
\
n
'
)
out
,
err
=
p
.
communicate
(
b'hello world
\
n
'
)
code
=
p
.
poll
()
code
=
p
.
poll
()
...
...
src/gevent/tests/test__issue600.py
View file @
2832922f
...
@@ -26,7 +26,7 @@ class TestIssue600(greentest.TestCase):
...
@@ -26,7 +26,7 @@ class TestIssue600(greentest.TestCase):
# Run a subprocess through Popen to make sure
# Run a subprocess through Popen to make sure
# libev is handling SIGCHLD. This could *probably* be simplified to use
# libev is handling SIGCHLD. This could *probably* be simplified to use
# just hub.loop.install_sigchld
# just hub.loop.install_sigchld
# (no __enter__/__exit__ on Py2) pylint:disable=consider-using-with
p
=
Popen
([
sys
.
executable
,
'-V'
],
stdout
=
PIPE
,
stderr
=
PIPE
)
p
=
Popen
([
sys
.
executable
,
'-V'
],
stdout
=
PIPE
,
stderr
=
PIPE
)
gevent
.
sleep
(
0
)
gevent
.
sleep
(
0
)
p
.
communicate
()
p
.
communicate
()
...
...
src/gevent/tests/test__issues461_471.py
View file @
2832922f
...
@@ -45,6 +45,7 @@ else:
...
@@ -45,6 +45,7 @@ else:
kwargs
=
{
'creationflags'
:
CREATE_NEW_PROCESS_GROUP
}
kwargs
=
{
'creationflags'
:
CREATE_NEW_PROCESS_GROUP
}
else
:
else
:
kwargs
=
{}
kwargs
=
{}
# (not on Py2) pylint:disable=consider-using-with
p
=
Popen
([
sys
.
executable
,
__file__
,
'subprocess'
],
stdout
=
PIPE
,
**
kwargs
)
p
=
Popen
([
sys
.
executable
,
__file__
,
'subprocess'
],
stdout
=
PIPE
,
**
kwargs
)
line
=
p
.
stdout
.
readline
()
line
=
p
.
stdout
.
readline
()
if
not
isinstance
(
line
,
str
):
if
not
isinstance
(
line
,
str
):
...
...
src/gevent/tests/test__local.py
View file @
2832922f
...
@@ -12,7 +12,7 @@ from zope import interface
...
@@ -12,7 +12,7 @@ from zope import interface
try
:
try
:
from
collections.abc
import
Mapping
from
collections.abc
import
Mapping
except
ImportError
:
except
ImportError
:
from
collections
import
Mapping
from
collections
import
Mapping
# pylint:disable=deprecated-class
class
ReadProperty
(
object
):
class
ReadProperty
(
object
):
"""A property that can be overridden"""
"""A property that can be overridden"""
...
@@ -72,7 +72,7 @@ class WithGetattr(local):
...
@@ -72,7 +72,7 @@ class WithGetattr(local):
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
if
name
==
'foo'
:
if
name
==
'foo'
:
return
42
return
42
return
super
(
WithGetattr
,
self
).
__getattr__
(
name
)
return
super
(
WithGetattr
,
self
).
__getattr__
(
name
)
# pylint:disable=no-member
class
LocalWithABC
(
local
,
Mapping
):
class
LocalWithABC
(
local
,
Mapping
):
...
@@ -263,7 +263,7 @@ class TestGeventLocal(greentest.TestCase):
...
@@ -263,7 +263,7 @@ class TestGeventLocal(greentest.TestCase):
mylocal
.
CLASS_PROP
=
1
mylocal
.
CLASS_PROP
=
1
self
.
assertEqual
(
1
,
mylocal
.
CLASS_PROP
)
self
.
assertEqual
(
1
,
mylocal
.
CLASS_PROP
)
self
.
assertEqual
(
mylocal
.
__dict__
[
'CLASS_PROP'
],
1
)
self
.
assertEqual
(
mylocal
.
__dict__
[
'CLASS_PROP'
],
1
)
# pylint:disable=unsubscriptable-object
del
mylocal
.
CLASS_PROP
del
mylocal
.
CLASS_PROP
self
.
assertEqual
(
42
,
mylocal
.
CLASS_PROP
)
self
.
assertEqual
(
42
,
mylocal
.
CLASS_PROP
)
...
...
src/gevent/tests/test__makefile_ref.py
View file @
2832922f
...
@@ -33,6 +33,8 @@ try:
...
@@ -33,6 +33,8 @@ try:
except
ImportError
:
except
ImportError
:
psutil
=
None
psutil
=
None
# wrap_socket() is considered deprecated in 3.9
# pylint:disable=deprecated-method
class
Test
(
greentest
.
TestCase
):
class
Test
(
greentest
.
TestCase
):
...
...
src/gevent/tests/test__monkey.py
View file @
2832922f
...
@@ -70,10 +70,10 @@ class TestMonkey(SubscriberCleanupMixin, unittest.TestCase):
...
@@ -70,10 +70,10 @@ class TestMonkey(SubscriberCleanupMixin, unittest.TestCase):
def
test_saved
(
self
):
def
test_saved
(
self
):
self
.
assertTrue
(
monkey
.
saved
)
self
.
assertTrue
(
monkey
.
saved
)
for
modname
in
monkey
.
saved
:
for
modname
,
objects
in
monkey
.
saved
.
items
()
:
self
.
assertTrue
(
monkey
.
is_module_patched
(
modname
))
self
.
assertTrue
(
monkey
.
is_module_patched
(
modname
))
for
objname
in
monkey
.
saved
[
modname
]
:
for
objname
in
objects
:
self
.
assertTrue
(
monkey
.
is_object_patched
(
modname
,
objname
))
self
.
assertTrue
(
monkey
.
is_object_patched
(
modname
,
objname
))
def
test_patch_subprocess_twice
(
self
):
def
test_patch_subprocess_twice
(
self
):
...
...
src/gevent/tests/test__monkey_sigchld_3.py
View file @
2832922f
...
@@ -45,6 +45,7 @@ if hasattr(signal, 'SIGCHLD'):
...
@@ -45,6 +45,7 @@ if hasattr(signal, 'SIGCHLD'):
# Go through subprocess because we expect it to automatically
# Go through subprocess because we expect it to automatically
# set up the waiting for us.
# set up the waiting for us.
# not on Py2 pylint:disable=consider-using-with
popen
=
subprocess
.
Popen
([
sys
.
executable
,
'-c'
,
'import sys'
],
popen
=
subprocess
.
Popen
([
sys
.
executable
,
'-c'
,
'import sys'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
popen
.
stderr
.
read
()
popen
.
stderr
.
read
()
...
...
src/gevent/tests/test__pywsgi.py
View file @
2832922f
...
@@ -315,7 +315,7 @@ class TestCase(greentest.TestCase):
...
@@ -315,7 +315,7 @@ class TestCase(greentest.TestCase):
def
urlopen
(
self
,
*
args
,
**
kwargs
):
def
urlopen
(
self
,
*
args
,
**
kwargs
):
with
self
.
connect
()
as
sock
:
with
self
.
connect
()
as
sock
:
with
sock
.
makefile
(
bufsize
=
1
)
as
fd
:
with
sock
.
makefile
(
bufsize
=
1
)
as
fd
:
# pylint:disable=unexpected-keyword-arg
fd
.
write
(
'GET / HTTP/1.1
\
r
\
n
Host: localhost
\
r
\
n
\
r
\
n
'
)
fd
.
write
(
'GET / HTTP/1.1
\
r
\
n
Host: localhost
\
r
\
n
\
r
\
n
'
)
return
read_http
(
fd
,
*
args
,
**
kwargs
)
return
read_http
(
fd
,
*
args
,
**
kwargs
)
...
@@ -857,7 +857,7 @@ class HttpsTestCase(TestCase):
...
@@ -857,7 +857,7 @@ class HttpsTestCase(TestCase):
def
urlopen
(
self
,
method
=
'GET'
,
post_body
=
None
,
**
kwargs
):
# pylint:disable=arguments-differ
def
urlopen
(
self
,
method
=
'GET'
,
post_body
=
None
,
**
kwargs
):
# pylint:disable=arguments-differ
import
ssl
import
ssl
with
self
.
connect
()
as
raw_sock
:
with
self
.
connect
()
as
raw_sock
:
with
ssl
.
wrap_socket
(
raw_sock
)
as
sock
:
with
ssl
.
wrap_socket
(
raw_sock
)
as
sock
:
# pylint:disable=deprecated-method
with
sock
.
makefile
(
bufsize
=
1
)
as
fd
:
# pylint:disable=unexpected-keyword-arg
with
sock
.
makefile
(
bufsize
=
1
)
as
fd
:
# pylint:disable=unexpected-keyword-arg
fd
.
write
(
'%s / HTTP/1.1
\
r
\
n
Host: localhost
\
r
\
n
'
%
method
)
fd
.
write
(
'%s / HTTP/1.1
\
r
\
n
Host: localhost
\
r
\
n
'
%
method
)
if
post_body
is
not
None
:
if
post_body
is
not
None
:
...
@@ -1632,10 +1632,10 @@ class TestInputRaw(greentest.BaseTestCase):
...
@@ -1632,10 +1632,10 @@ class TestInputRaw(greentest.BaseTestCase):
return
Input
(
StringIO
(
data
),
content_length
=
content_length
,
chunked_input
=
chunked_input
)
return
Input
(
StringIO
(
data
),
content_length
=
content_length
,
chunked_input
=
chunked_input
)
if
PY3
:
if
PY3
:
def
assertEqual
(
self
,
data
,
expected
,
*
args
):
# pylint:disable=arguments-differ
def
assertEqual
(
self
,
first
,
second
,
msg
=
None
):
if
isinstance
(
expecte
d
,
str
):
if
isinstance
(
secon
d
,
str
):
expected
=
expecte
d
.
encode
(
'ascii'
)
second
=
secon
d
.
encode
(
'ascii'
)
super
(
TestInputRaw
,
self
).
assertEqual
(
data
,
expected
,
*
args
)
super
(
TestInputRaw
,
self
).
assertEqual
(
first
,
second
,
msg
)
def
test_short_post
(
self
):
def
test_short_post
(
self
):
i
=
self
.
make_input
(
"1"
,
content_length
=
2
)
i
=
self
.
make_input
(
"1"
,
content_length
=
2
)
...
...
src/gevent/tests/test__refcount.py
View file @
2832922f
...
@@ -98,7 +98,7 @@ class Server(object):
...
@@ -98,7 +98,7 @@ class Server(object):
self
.
listening
=
True
self
.
listening
=
True
try
:
try
:
conn
,
_
=
self
.
socket
.
accept
()
conn
,
_
=
self
.
socket
.
accept
()
# pylint:disable=no-member
except
socket
.
timeout
:
except
socket
.
timeout
:
if
self
.
raise_on_timeout
:
if
self
.
raise_on_timeout
:
raise
raise
...
...
src/gevent/tests/test__socket.py
View file @
2832922f
...
@@ -33,6 +33,9 @@ from threading import Event
...
@@ -33,6 +33,9 @@ from threading import Event
errno_types
=
int
errno_types
=
int
# socket.accept/unwrap/makefile aren't found for some reason
# pylint:disable=no-member
class
BaseThread
(
object
):
class
BaseThread
(
object
):
terminal_exc
=
None
terminal_exc
=
None
...
...
src/gevent/tests/test__ssl.py
View file @
2832922f
...
@@ -15,6 +15,7 @@ from gevent.testing import PY2
...
@@ -15,6 +15,7 @@ from gevent.testing import PY2
def
ssl_listener
(
private_key
,
certificate
):
def
ssl_listener
(
private_key
,
certificate
):
raw_listener
=
socket
.
socket
()
raw_listener
=
socket
.
socket
()
greentest
.
bind_and_listen
(
raw_listener
)
greentest
.
bind_and_listen
(
raw_listener
)
# pylint:disable=deprecated-method
sock
=
ssl
.
wrap_socket
(
raw_listener
,
private_key
,
certificate
,
server_side
=
True
)
sock
=
ssl
.
wrap_socket
(
raw_listener
,
private_key
,
certificate
,
server_side
=
True
)
return
sock
,
raw_listener
return
sock
,
raw_listener
...
@@ -40,6 +41,7 @@ class TestSSL(test__socket.TestTCP):
...
@@ -40,6 +41,7 @@ class TestSSL(test__socket.TestTCP):
def
create_connection
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=signature-differs
def
create_connection
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=signature-differs
return
self
.
_close_on_teardown
(
return
self
.
_close_on_teardown
(
# pylint:disable=deprecated-method
ssl
.
wrap_socket
(
super
(
TestSSL
,
self
).
create_connection
(
*
args
,
**
kwargs
)))
ssl
.
wrap_socket
(
super
(
TestSSL
,
self
).
create_connection
(
*
args
,
**
kwargs
)))
# The SSL library can take a long time to buffer the large amount of data we're trying
# The SSL library can take a long time to buffer the large amount of data we're trying
...
@@ -67,7 +69,9 @@ class TestSSL(test__socket.TestTCP):
...
@@ -67,7 +69,9 @@ class TestSSL(test__socket.TestTCP):
# Issue #317: SSL_WRITE_PENDING in some corner cases
# Issue #317: SSL_WRITE_PENDING in some corner cases
server_sock
=
[]
server_sock
=
[]
acceptor
=
test__socket
.
Thread
(
target
=
lambda
:
server_sock
.
append
(
self
.
listener
.
accept
()))
acceptor
=
test__socket
.
Thread
(
target
=
lambda
:
server_sock
.
append
(
# pylint:disable=no-member
self
.
listener
.
accept
()))
client
=
self
.
create_connection
()
client
=
self
.
create_connection
()
client
.
setblocking
(
False
)
client
.
setblocking
(
False
)
try
:
try
:
...
...
src/gevent/tests/test__subprocess_interrupted.py
View file @
2832922f
...
@@ -15,6 +15,7 @@ else:
...
@@ -15,6 +15,7 @@ else:
import
subprocess
import
subprocess
for
_
in
range
(
5
):
for
_
in
range
(
5
):
# not on Py2 pylint:disable=consider-using-with
out
,
err
=
subprocess
.
Popen
([
sys
.
executable
,
'-W'
,
'ignore'
,
out
,
err
=
subprocess
.
Popen
([
sys
.
executable
,
'-W'
,
'ignore'
,
__file__
,
'runtestcase'
],
__file__
,
'runtestcase'
],
stderr
=
subprocess
.
PIPE
).
communicate
()
stderr
=
subprocess
.
PIPE
).
communicate
()
...
...
src/gevent/tests/test__threading.py
View file @
2832922f
...
@@ -59,6 +59,7 @@ class TestLockThread(greentest.TestCase):
...
@@ -59,6 +59,7 @@ class TestLockThread(greentest.TestCase):
def
test_spin_lock_switches
(
self
):
def
test_spin_lock_switches
(
self
):
# https://github.com/gevent/gevent/issues/1464
# https://github.com/gevent/gevent/issues/1464
# pylint:disable=consider-using-with
lock
=
threading
.
Lock
()
lock
=
threading
.
Lock
()
lock
.
acquire
()
lock
.
acquire
()
spawned
=
[]
spawned
=
[]
...
...
src/gevent/tests/test__threading_2.py
View file @
2832922f
...
@@ -45,6 +45,8 @@ import weakref
...
@@ -45,6 +45,8 @@ import weakref
from
gevent.tests
import
lock_tests
from
gevent.tests
import
lock_tests
verbose
=
False
verbose
=
False
# pylint:disable=consider-using-with
# A trivial mutable counter.
# A trivial mutable counter.
def
skipDueToHang
(
cls
):
def
skipDueToHang
(
cls
):
...
...
src/gevent/threading.py
View file @
2832922f
...
@@ -143,6 +143,7 @@ class _DummyThread(_DummyThread_):
...
@@ -143,6 +143,7 @@ class _DummyThread(_DummyThread_):
ref
=
self
.
__weakref_ref
ref
=
self
.
__weakref_ref
ref
=
ref
(
g
,
_make_cleanup_id
(
gid
))
# pylint:disable=too-many-function-args
ref
=
ref
(
g
,
_make_cleanup_id
(
gid
))
# pylint:disable=too-many-function-args
self
.
__raw_ref
=
ref
self
.
__raw_ref
=
ref
assert
self
.
__raw_ref
is
ref
# prevent pylint thinking its unused
def
_Thread__stop
(
self
):
def
_Thread__stop
(
self
):
pass
pass
...
...
src/gevent/threadpool.py
View file @
2832922f
...
@@ -552,7 +552,7 @@ class _FakeAsync(object):
...
@@ -552,7 +552,7 @@ class _FakeAsync(object):
pass
pass
close
=
stop
=
send
close
=
stop
=
send
def
__call_
(
self
,
result
):
def
__call_
_
(
self
,
result
):
"fake out for 'receiver'"
"fake out for 'receiver'"
def
__bool__
(
self
):
def
__bool__
(
self
):
...
...
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