Commit e820c958 authored by Jason Madden's avatar Jason Madden

landscape/pylint cleanups.

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