Commit cf19786a authored by Jason Madden's avatar Jason Madden

Update for new pilint warnings, and new release of the epel package.

See failed builds at https://github.com/gevent/gevent/pull/1820/checks?check_run_id=3807405865
parent 26ed75cd
......@@ -52,7 +52,7 @@ limit-inference-results=1
# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching.
# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we
# "export" the variable and don't have a __all__.
# Pylint 2.6 adds some python-3-only things that don't apply
# Pylint 2.6+ adds some python-3-only things that don't apply: raise-missing-from, super-with-arguments, consider-using-f-string, redundant-u-string-prefix
disable=wrong-import-position,
wrong-import-order,
missing-docstring,
......@@ -77,7 +77,9 @@ disable=wrong-import-position,
import-outside-toplevel,
self-assigning-variable,
raise-missing-from,
super-with-arguments
super-with-arguments,
consider-using-f-string,
redundant-u-string-prefix
[FORMAT]
# duplicated from setup.cfg
......
......@@ -191,8 +191,8 @@ build_script:
# Build the compiled extension
# Try to get some things that don't wind up in the pip cache as
# built wheels if they're built during an isolated build.
- "%CMD_IN_ENV% %PYEXE% -m pip install --pre -U wheel cython setuptools cffi"
- if not "%GWHEEL_ONLY%"=="true" %PYEXE% -m pip install --pre -U -e .[test]
- "%CMD_IN_ENV% %PYEXE% -m pip install -U wheel cython setuptools cffi"
- if not "%GWHEEL_ONLY%"=="true" %PYEXE% -m pip install -U -e .[test]
test_script:
# Run the project tests
......@@ -208,7 +208,7 @@ after_test:
# https://ci.appveyor.com/project/denik/gevent/builds/23810605/job/83aw4u67artt002b#L602
# So we violate DRY and repeate some requirements in order to use
# --no-build-isolation
- "%CMD_IN_ENV% %PYEXE% -m pip install --pre wheel cython setuptools cffi twine"
- "%CMD_IN_ENV% %PYEXE% -m pip install wheel cython setuptools cffi twine"
- "%CMD_IN_ENV% %PYEXE% -m pip wheel --no-build-isolation . -w dist"
- ps: "ls dist"
......
......@@ -83,7 +83,7 @@ if [ -d /gevent -a -d /opt/python ]; then
if [ -n "$SLOW_ARM" ]; then
# This provides access to ccache for the 2014 image
echo Installing epel
rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
fi
yum -y install ccache || export CC=gcc LDSHARED="gcc -shared" LDCXXSHARED="gcc -shared"
# On Fedora Rawhide (F33)
......
......@@ -184,7 +184,7 @@ class MultipleWaiter(Waiter):
# more efficient, but since we're in the hub we avoid imports if
# we can help it to better support monkey-patching, and delaying the import
# here can be impractical (see https://github.com/gevent/gevent/issues/652)
self._values = list()
self._values = []
def switch(self, value):
self._values.append(value)
......
......@@ -3,7 +3,7 @@
.. deprecated:: 1.3
Use :mod:`gevent.resolver.cares`
"""
# pylint:disable=no-name-in-module,import-error
from gevent.resolver.cares import * # pylint:disable=wildcard-import,unused-wildcard-import,
import gevent.resolver.cares as _cares
__all__ = _cares.__all__ # pylint:disable=c-extension-no-member
......
......@@ -96,7 +96,7 @@ class _ContextData(object):
)
def __init__(self):
self._mapping = dict()
self._mapping = {}
def __getitem__(self, key):
return self._mapping[key]
......
......@@ -32,6 +32,7 @@ ffi = FFI()
distutils_ext = _setuplibev.build_extension()
def read_source(name):
# pylint:disable=unspecified-encoding
with open(os.path.join(thisdir, name), 'r') as f:
return f.read()
......
......@@ -37,6 +37,7 @@ setup_py_dir = os.path.abspath(os.path.join(thisdir, '..', '..', '..'))
libuv_dir = os.path.abspath(os.path.join(setup_py_dir, 'deps', 'libuv'))
def read_source(name):
# pylint:disable=unspecified-encoding
with open(os.path.join(thisdir, name), 'r') as f:
return f.read()
......
......@@ -113,7 +113,7 @@ class loop(AbstractLoop):
def __init__(self, flags=None, default=None):
AbstractLoop.__init__(self, ffi, libuv, _watchers, flags, default)
self._child_watchers = defaultdict(list)
self._io_watchers = dict()
self._io_watchers = {}
self._fork_watchers = set()
self._pid = os.getpid()
self._default = (self._ptr == libuv.uv_default_loop())
......
......@@ -368,7 +368,7 @@ class local(object):
def __cinit__(self, *args, **kw):
if args or kw:
if type(self).__init__ == object.__init__:
if type(self).__init__ == object.__init__: # pylint:disable=comparison-with-callable
raise TypeError("Initialization arguments are not supported", args, kw)
impl = _localimpl(args, kw, type(self), id(self))
# pylint:disable=attribute-defined-outside-init
......
......@@ -204,7 +204,7 @@ class GroupMappingMixin(object):
def map_cb(self, func, iterable, callback=None):
result = self.map(func, iterable)
if callback is not None:
callback(result)
callback(result) # pylint:disable=not-callable
return result
def map_async(self, func, iterable, callback=None):
......
......@@ -63,7 +63,7 @@ _MONTHNAME = [None, # Dummy so we can use 1-based month numbers
_HEX = string.hexdigits.encode('ascii')
# Errors
_ERRORS = dict()
_ERRORS = {}
_INTERNAL_ERROR_STATUS = '500 Internal Server Error'
_INTERNAL_ERROR_BODY = b'Internal Server Error'
_INTERNAL_ERROR_HEADERS = [('Content-Type', 'text/plain'),
......@@ -467,7 +467,7 @@ class WSGIHandler(object):
if result is True:
continue
self.status, response_body = result
self.status, response_body = result # pylint:disable=unpacking-non-sequence
self.socket.sendall(response_body)
if self.time_finish == 0:
self.time_finish = time.time()
......
......@@ -536,7 +536,7 @@ class _CommunicatingGreenlets(object):
# Python 2 doesn't have a BrokenPipeError.
if isinstance(ex, BrokenPipeError) and ex.errno is None:
ex.errno = errno.EPIPE
if ex.errno != errno.EPIPE and ex.errno != errno.EINVAL:
if ex.errno not in (errno.EPIPE, errno.EINVAL):
raise
finally:
try:
......
......@@ -74,7 +74,7 @@ test_name = os.path.splitext(test_filename)[0]
if sys.version_info[0] >= 3:
module_file = open(test_filename, encoding='utf-8') # pylint:disable=consider-using-with
else:
module_file = open(test_filename) # pylint:disable=consider-using-with
module_file = open(test_filename) # pylint:disable=consider-using-with,unspecified-encoding
with module_file:
module_source = module_file.read()
module_source = disable_tests_in_source(module_source, test_name)
......
......@@ -77,7 +77,8 @@ else:
if os.system(lsof_command):
# XXX: This prints to the console an annoying message: 'lsof is not recognized'
raise unittest.SkipTest("lsof failed")
with open(tmpname) as fobj:
with open(tmpname) as fobj: # pylint:disable=unspecified-encoding
data = fobj.read().strip()
os.remove(tmpname)
return data
......@@ -146,7 +147,7 @@ else:
return sockets in a state like that.
"""
results = dict()
results = {}
for _ in range(3):
try:
......
......@@ -589,6 +589,7 @@ class Discovery(object):
def load_list_from_file(filename, package):
result = []
if filename:
# pylint:disable=unspecified-encoding
with open(_package_relative_filename(filename, package)) as f:
for x in f:
x = x.split('#', 1)[0].strip()
......@@ -899,7 +900,7 @@ def main():
if options.config:
config = {}
options.config = _package_relative_filename(options.config, options.package)
with open(options.config) as f:
with open(options.config) as f: # pylint:disable=unspecified-encoding
config_data = f.read()
six.exec_(config_data, config)
FAILING_TESTS = config['FAILING_TESTS']
......
......@@ -7,13 +7,13 @@ Test for issue #1526:
from __future__ import print_function
from __future__ import absolute_import
import dns
import dns # pylint:disable=import-error
assert dns
import gevent.socket as socket # pylint:disable=consider-using-from-import
socket.getfqdn() # create the resolver
from gevent.resolver.dnspython import dns as gdns
import dns.rdtypes
import dns.rdtypes # pylint:disable=import-error
assert dns is not gdns, (dns, gdns)
assert dns.rdtypes is not gdns.rdtypes
......
......@@ -8,7 +8,7 @@ from __future__ import print_function, absolute_import
from gevent import monkey
monkey.patch_all()
# pylint:disable=import-error
import dns
assert dns
......
......@@ -37,6 +37,7 @@ def TESTRUNNER(tests=None):
color="suboptimal-behaviour")
return
# pylint:disable=unspecified-encoding
with open(os.path.join(test_dir, 'version')) as f:
preferred_version = f.read().strip()
......
......@@ -49,6 +49,7 @@ class _AbstractTestMixin(util.ExampleMixin):
def _check_resources(self):
from gevent.testing import resources
# pylint:disable=unspecified-encoding
with open(os.path.join(self.cwd, self.example), 'r') as f:
contents = f.read()
......
......@@ -30,6 +30,7 @@ except NameError:
class ResourceWarning(Warning):
"Python 2 fallback"
# pylint:disable=unspecified-encoding
def Writer(fobj, line):
for character in line:
......
......@@ -77,7 +77,7 @@ def get_ident(gr=None):
def start_new_thread(function, args=(), kwargs=None):
if kwargs is not None:
greenlet = Greenlet.spawn(function, *args, **kwargs)
greenlet = Greenlet.spawn(function, *args, **kwargs) # pylint:disable=not-a-mapping
else:
greenlet = Greenlet.spawn(function, *args)
return get_ident(greenlet)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment