Commit e820c958 authored by Jason Madden's avatar Jason Madden

landscape/pylint cleanups.

parent e52414db
......@@ -20,6 +20,9 @@ ignore-paths:
- util
# likewise with scripts
- scripts/
# This file has invalid syntax for Python 3, which is how
# landscape.io runs things
- gevent/_util_py2.py
ignore-patterns:
# disabled code
- greentest/xtest_.*py
......
......@@ -28,6 +28,10 @@ disable=wrong-import-position,
locally-disabled,
# most of these are deferred imports
cyclic-import,
# these are almost always because that's what the stdlib does
too-many-arguments,
# likewise: these tend to be keyword arguments like len= in the stdlib
redefined-builtin,
[FORMAT]
# duplicated from setup.cfg
......
......@@ -9,14 +9,11 @@ This module implements cooperative SSL socket wrappers.
from __future__ import absolute_import
# Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable
# pylint: disable=undefined-variable,arguments-differ,no-member
import ssl as __ssl__
try:
_ssl = __ssl__._ssl
except AttributeError:
_ssl = __ssl__._ssl2
_ssl = __ssl__._ssl
import sys
import errno
......@@ -443,8 +440,7 @@ def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
If 'ca_certs' is specified, validate the server cert against it.
If 'ssl_version' is specified, use it in the connection attempt."""
host, port = addr
if (ca_certs is not None):
if ca_certs is not None:
cert_reqs = CERT_REQUIRED
else:
cert_reqs = CERT_NONE
......
......@@ -8,6 +8,10 @@ This module implements cooperative SSL socket wrappers.
"""
from __future__ import absolute_import
# Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable
import ssl as __ssl__
_ssl = __ssl__._ssl
......
......@@ -10,6 +10,8 @@ in this module only block the current greenlet and let the others run.
For convenience, exceptions (like :class:`error <socket.error>` and :class:`timeout <socket.timeout>`)
as well as the constants from the :mod:`socket` module are imported into this module.
"""
# Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable
import sys
from gevent.hub import PY3
......@@ -62,7 +64,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
host, port = address
err = None
for res in getaddrinfo(host, port, 0 if has_ipv6 else AF_INET, SOCK_STREAM):
af, socktype, proto, _canonname, sa = res
af, socktype, proto, _, sa = res
sock = None
try:
sock = socket(af, socktype, proto)
......@@ -78,12 +80,12 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
# that does not happen with regular sockets though, because _socket.socket.connect() is a built-in.
# this is similar to "getnameinfo loses a reference" failure in test_socket.py
if not PY3:
sys.exc_clear()
sys.exc_clear() # pylint:disable=no-member
if sock is not None:
sock.close()
err = ex
if err is not None:
raise err
raise err # pylint:disable=raising-bad-type
else:
raise error("getaddrinfo returns an empty list")
......
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