Skip to content

Commit

Permalink
landscape/pylint cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Mar 10, 2016
1 parent e52414d commit e820c95
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .landscape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions gevent/_ssl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@

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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions gevent/_sslgte279.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"""

from __future__ import absolute_import
# Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable


import ssl as __ssl__

_ssl = __ssl__._ssl
Expand Down
8 changes: 5 additions & 3 deletions gevent/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
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
Expand Down Expand Up @@ -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)
Expand All @@ -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")

Expand Down

0 comments on commit e820c95

Please sign in to comment.