further remove evidence of pylint.
This just removes comments '# pylint:' things and other code remnents of pylint.
This commit is contained in:
parent
309e21aec1
commit
6b2fc2034a
2
Makefile
2
Makefile
@ -58,5 +58,5 @@ rpm:
|
||||
deb:
|
||||
./packages/bddeb
|
||||
|
||||
.PHONY: test pylint pyflakes 2to3 clean pep8 rpm deb yaml check_version
|
||||
.PHONY: test pyflakes 2to3 clean pep8 rpm deb yaml check_version
|
||||
.PHONY: pip-test-requirements pip-requirements clean_pyc
|
||||
|
@ -484,7 +484,7 @@ def get_partition_mbr_layout(size, layout):
|
||||
def purge_disk_ptable(device):
|
||||
# wipe the first and last megabyte of a disk (or file)
|
||||
# gpt stores partition table both at front and at end.
|
||||
null = '\0' # pylint: disable=W1401
|
||||
null = '\0'
|
||||
start_len = 1024 * 1024
|
||||
end_len = 1024 * 1024
|
||||
with open(device, "rb+") as fp:
|
||||
|
@ -18,7 +18,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from string import whitespace # pylint: disable=W0402
|
||||
from string import whitespace
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
|
@ -119,7 +119,7 @@ def load_power_state(cfg):
|
||||
|
||||
|
||||
def doexit(sysexit):
|
||||
os._exit(sysexit) # pylint: disable=W0212
|
||||
os._exit(sysexit)
|
||||
|
||||
|
||||
def execmd(exe_args, output=None, data_in=None):
|
||||
@ -127,7 +127,7 @@ def execmd(exe_args, output=None, data_in=None):
|
||||
proc = subprocess.Popen(exe_args, stdin=subprocess.PIPE,
|
||||
stdout=output, stderr=subprocess.STDOUT)
|
||||
proc.communicate(data_in)
|
||||
ret = proc.returncode # pylint: disable=E1101
|
||||
ret = proc.returncode
|
||||
except Exception:
|
||||
doexit(EXIT_FAIL)
|
||||
doexit(ret)
|
||||
|
@ -28,19 +28,19 @@ from cloudinit import util
|
||||
frequency = PER_ALWAYS
|
||||
|
||||
|
||||
def _resize_btrfs(mount_point, devpth): # pylint: disable=W0613
|
||||
def _resize_btrfs(mount_point, devpth):
|
||||
return ('btrfs', 'filesystem', 'resize', 'max', mount_point)
|
||||
|
||||
|
||||
def _resize_ext(mount_point, devpth): # pylint: disable=W0613
|
||||
def _resize_ext(mount_point, devpth):
|
||||
return ('resize2fs', devpth)
|
||||
|
||||
|
||||
def _resize_xfs(mount_point, devpth): # pylint: disable=W0613
|
||||
def _resize_xfs(mount_point, devpth):
|
||||
return ('xfs_growfs', devpth)
|
||||
|
||||
|
||||
def _resize_ufs(mount_point, devpth): # pylint: disable=W0613
|
||||
def _resize_ufs(mount_point, devpth):
|
||||
return ('growfs', devpth)
|
||||
|
||||
# Do not use a dictionary as these commands should be able to be used
|
||||
|
@ -28,7 +28,7 @@ from cloudinit import distros as ds
|
||||
from cloudinit import ssh_util
|
||||
from cloudinit import util
|
||||
|
||||
from string import letters, digits # pylint: disable=W0402
|
||||
from string import letters, digits
|
||||
|
||||
# We are removing certain 'painful' letters/numbers
|
||||
PW_SET = (letters.translate(None, 'loLOI') +
|
||||
|
@ -137,8 +137,8 @@ class ResolvConf(object):
|
||||
self._contents.append(('option', ['search', s_list, '']))
|
||||
return flat_sds
|
||||
|
||||
@local_domain.setter # pl51222 pylint: disable=E1101
|
||||
def local_domain(self, domain): # pl51222 pylint: disable=E0102
|
||||
@local_domain.setter
|
||||
def local_domain(self, domain):
|
||||
self.parse()
|
||||
self._remove_option('domain')
|
||||
self._contents.append(('option', ['domain', str(domain), '']))
|
||||
|
@ -53,8 +53,7 @@ class BootHookPartHandler(handlers.Handler):
|
||||
util.write_file(filepath, contents.lstrip(), 0700)
|
||||
return filepath
|
||||
|
||||
def handle_part(self, _data, ctype, filename, # pylint: disable=W0221
|
||||
payload, frequency): # pylint: disable=W0613
|
||||
def handle_part(self, data, ctype, filename, payload, frequency):
|
||||
if ctype in handlers.CONTENT_SIGNALS:
|
||||
return
|
||||
|
||||
|
@ -138,8 +138,7 @@ class CloudConfigPartHandler(handlers.Handler):
|
||||
self.file_names = []
|
||||
self.cloud_buf = None
|
||||
|
||||
def handle_part(self, _data, ctype, filename, # pylint: disable=W0221
|
||||
payload, _frequency, headers): # pylint: disable=W0613
|
||||
def handle_part(self, data, ctype, filename, payload, frequency, headers):
|
||||
if ctype == handlers.CONTENT_START:
|
||||
self._reset()
|
||||
return
|
||||
|
@ -44,8 +44,7 @@ class ShellScriptPartHandler(handlers.Handler):
|
||||
handlers.type_from_starts_with(SHELL_PREFIX),
|
||||
]
|
||||
|
||||
def handle_part(self, _data, ctype, filename, # pylint: disable=W0221
|
||||
payload, frequency): # pylint: disable=W0613
|
||||
def handle_part(self, data, ctype, filename, payload, frequency):
|
||||
if ctype in handlers.CONTENT_SIGNALS:
|
||||
# TODO(harlowja): maybe delete existing things here
|
||||
return
|
||||
|
@ -44,8 +44,7 @@ class UpstartJobPartHandler(handlers.Handler):
|
||||
handlers.type_from_starts_with(UPSTART_PREFIX),
|
||||
]
|
||||
|
||||
def handle_part(self, _data, ctype, filename, # pylint: disable=W0221
|
||||
payload, frequency):
|
||||
def handle_part(self, data, ctype, filename, payload, frequency):
|
||||
if ctype in handlers.CONTENT_SIGNALS:
|
||||
return
|
||||
|
||||
|
@ -41,7 +41,7 @@ def _patch_logging():
|
||||
fallback_handler = QuietStreamHandler(sys.stderr)
|
||||
fallback_handler.setFormatter(logging.Formatter(FALL_FORMAT))
|
||||
|
||||
def handleError(self, record): # pylint: disable=W0613
|
||||
def handleError(self, record):
|
||||
try:
|
||||
fallback_handler.handle(record)
|
||||
fallback_handler.flush()
|
||||
|
@ -28,7 +28,7 @@ import base64
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
import string # pylint: disable=W0402
|
||||
import string
|
||||
|
||||
from cloudinit import log as logging
|
||||
from cloudinit import sources
|
||||
|
@ -19,8 +19,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# pylint: disable=C0302
|
||||
|
||||
import types
|
||||
|
||||
|
@ -44,7 +44,7 @@ try:
|
||||
from distutils.version import LooseVersion
|
||||
import pkg_resources
|
||||
_REQ = pkg_resources.get_distribution('requests')
|
||||
_REQ_VER = LooseVersion(_REQ.version) # pylint: disable=E1103
|
||||
_REQ_VER = LooseVersion(_REQ.version)
|
||||
if _REQ_VER >= LooseVersion('0.8.8'):
|
||||
SSL_ENABLED = True
|
||||
if _REQ_VER >= LooseVersion('0.7.0') and _REQ_VER < LooseVersion('1.0.0'):
|
||||
@ -54,7 +54,7 @@ except:
|
||||
|
||||
|
||||
def _cleanurl(url):
|
||||
parsed_url = list(urlparse(url, scheme='http')) # pylint: disable=E1123
|
||||
parsed_url = list(urlparse(url, scheme='http'))
|
||||
if not parsed_url[1] and parsed_url[2]:
|
||||
# Swap these since this seems to be a common
|
||||
# occurrence when given urls like 'www.google.com'
|
||||
@ -90,7 +90,7 @@ class StringResponse(object):
|
||||
self.contents = contents
|
||||
self.url = None
|
||||
|
||||
def ok(self, *args, **kwargs): # pylint: disable=W0613
|
||||
def ok(self, *args, **kwargs):
|
||||
if self.code != 200:
|
||||
return False
|
||||
return True
|
||||
@ -150,7 +150,7 @@ class UrlError(IOError):
|
||||
|
||||
def _get_ssl_args(url, ssl_details):
|
||||
ssl_args = {}
|
||||
scheme = urlparse(url).scheme # pylint: disable=E1101
|
||||
scheme = urlparse(url).scheme
|
||||
if scheme == 'https' and ssl_details:
|
||||
if not SSL_ENABLED:
|
||||
LOG.warn("SSL is not supported in requests v%s, "
|
||||
@ -227,10 +227,9 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
|
||||
|
||||
r = requests.request(**req_args)
|
||||
if check_status:
|
||||
r.raise_for_status() # pylint: disable=E1103
|
||||
r.raise_for_status()
|
||||
LOG.debug("Read from %s (%s, %sb) after %s attempts", url,
|
||||
r.status_code, len(r.content), # pylint: disable=E1103
|
||||
(i + 1))
|
||||
r.status_code, len(r.content), (i + 1))
|
||||
# Doesn't seem like we can make it use a different
|
||||
# subclass for responses, so add our own backward-compat
|
||||
# attrs
|
||||
|
@ -19,8 +19,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# pylint: disable=C0302
|
||||
|
||||
from StringIO import StringIO
|
||||
|
||||
@ -42,7 +40,7 @@ import re
|
||||
import shutil
|
||||
import socket
|
||||
import stat
|
||||
import string # pylint: disable=W0402
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@ -198,11 +196,11 @@ def fork_cb(child_cb, *args):
|
||||
if fid == 0:
|
||||
try:
|
||||
child_cb(*args)
|
||||
os._exit(0) # pylint: disable=W0212
|
||||
os._exit(0)
|
||||
except:
|
||||
logexc(LOG, "Failed forking and calling callback %s",
|
||||
type_utils.obj_name(child_cb))
|
||||
os._exit(1) # pylint: disable=W0212
|
||||
os._exit(1)
|
||||
else:
|
||||
LOG.debug("Forked child %s who will run callback %s",
|
||||
fid, type_utils.obj_name(child_cb))
|
||||
@ -487,7 +485,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None):
|
||||
new_fp = open(arg, owith)
|
||||
elif mode == "|":
|
||||
proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE)
|
||||
new_fp = proc.stdin # pylint: disable=E1101
|
||||
new_fp = proc.stdin
|
||||
else:
|
||||
raise TypeError("Invalid type for output format: %s" % outfmt)
|
||||
|
||||
@ -509,7 +507,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None):
|
||||
new_fp = open(arg, owith)
|
||||
elif mode == "|":
|
||||
proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE)
|
||||
new_fp = proc.stdin # pylint: disable=E1101
|
||||
new_fp = proc.stdin
|
||||
else:
|
||||
raise TypeError("Invalid type for error format: %s" % errfmt)
|
||||
|
||||
@ -937,7 +935,7 @@ def is_resolvable(name):
|
||||
should also not exist. The random entry will be resolved inside
|
||||
the search list.
|
||||
"""
|
||||
global _DNS_REDIRECT_IP # pylint: disable=W0603
|
||||
global _DNS_REDIRECT_IP
|
||||
if _DNS_REDIRECT_IP is None:
|
||||
badips = set()
|
||||
badnames = ("does-not-exist.example.com.", "example.invalid.",
|
||||
@ -1532,7 +1530,7 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
|
||||
(out, err) = sp.communicate(data)
|
||||
except OSError as e:
|
||||
raise ProcessExecutionError(cmd=args, reason=e)
|
||||
rc = sp.returncode # pylint: disable=E1101
|
||||
rc = sp.returncode
|
||||
if rc not in rcs:
|
||||
raise ProcessExecutionError(stdout=out, stderr=err,
|
||||
exit_code=rc,
|
||||
|
@ -9,7 +9,6 @@ Build-Depends: debhelper (>= 9),
|
||||
python (>= 2.6.6-3~),
|
||||
python-nose,
|
||||
pyflakes,
|
||||
pylint,
|
||||
python-setuptools,
|
||||
python-selinux,
|
||||
python-cheetah,
|
||||
|
19
pylintrc
19
pylintrc
@ -1,19 +0,0 @@
|
||||
[General]
|
||||
init-hook='import sys; sys.path.append("tests/")'
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
# See: http://pylint-messages.wikidot.com/all-codes
|
||||
# W0142: *args and **kwargs are fine.
|
||||
# W0511: TODOs in code comments are fine.
|
||||
# W0702: No exception type(s) specified
|
||||
# W0703: Catch "Exception"
|
||||
# C0103: Invalid name
|
||||
# C0111: Missing docstring
|
||||
disable=W0142,W0511,W0702,W0703,C0103,C0111
|
||||
|
||||
[REPORTS]
|
||||
reports=no
|
||||
include-ids=yes
|
||||
|
||||
[FORMAT]
|
||||
max-line-length=79
|
2
setup.py
2
setup.py
@ -46,7 +46,7 @@ def tiny_p(cmd, capture=True):
|
||||
sp = subprocess.Popen(cmd, stdout=stdout,
|
||||
stderr=stderr, stdin=None)
|
||||
(out, err) = sp.communicate()
|
||||
ret = sp.returncode # pylint: disable=E1101
|
||||
ret = sp.returncode
|
||||
if ret not in [0]:
|
||||
raise RuntimeError("Failed running %s [rc=%s] (%s, %s)"
|
||||
% (cmd, ret, out, err))
|
||||
|
@ -18,8 +18,7 @@ class FakeModule(handlers.Handler):
|
||||
def list_types(self):
|
||||
return self.types
|
||||
|
||||
def handle_part(self, _data, ctype, filename, # pylint: disable=W0221
|
||||
payload, frequency):
|
||||
def handle_part(self, data, ctype, filename, payload, frequency):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -26,8 +26,8 @@ package_mirrors = [
|
||||
unknown_arch_info
|
||||
]
|
||||
|
||||
gpmi = distros._get_package_mirror_info # pylint: disable=W0212
|
||||
gapmi = distros._get_arch_package_mirror_info # pylint: disable=W0212
|
||||
gpmi = distros._get_package_mirror_info
|
||||
gapmi = distros._get_arch_package_mirror_info
|
||||
|
||||
|
||||
class TestGenericDistro(helpers.FilesystemMockingTestCase):
|
||||
|
@ -203,8 +203,6 @@ def simple_device_part_info(devpath):
|
||||
|
||||
|
||||
class Bunch(object):
|
||||
st_mode = None # fix pylint complaint
|
||||
|
||||
def __init__(self, **kwds):
|
||||
self.__dict__.update(kwds)
|
||||
|
||||
|
@ -11,7 +11,7 @@ import glob
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import string # pylint: disable=W0402
|
||||
import string
|
||||
|
||||
SOURCE_PAT = "source*.*yaml"
|
||||
EXPECTED_PAT = "expected%s.yaml"
|
||||
|
@ -1,5 +1,3 @@
|
||||
# pylint: disable=C0301
|
||||
# the mountinfo data lines are too long
|
||||
import os
|
||||
import stat
|
||||
import yaml
|
||||
@ -18,7 +16,7 @@ class FakeSelinux(object):
|
||||
self.match_what = match_what
|
||||
self.restored = []
|
||||
|
||||
def matchpathcon(self, path, mode): # pylint: disable=W0613
|
||||
def matchpathcon(self, path, mode):
|
||||
if path == self.match_what:
|
||||
return
|
||||
else:
|
||||
@ -27,7 +25,7 @@ class FakeSelinux(object):
|
||||
def is_selinux_enabled(self):
|
||||
return True
|
||||
|
||||
def restorecon(self, path, recursive): # pylint: disable=W0613
|
||||
def restorecon(self, path, recursive):
|
||||
self.restored.append(path)
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ def add_cloud():
|
||||
if not inspect.isfunction(function):
|
||||
continue
|
||||
if name.startswith("cloud_"):
|
||||
exec("pep8.%s = %s" % (name, name)) # pylint: disable=W0122
|
||||
exec("pep8.%s = %s" % (name, name))
|
||||
|
||||
if __name__ == "__main__":
|
||||
# NOVA based 'hacking.py' error codes start with an N
|
||||
@ -163,7 +163,7 @@ if __name__ == "__main__":
|
||||
pep8.current_file = current_file
|
||||
pep8.readlines = readlines
|
||||
try:
|
||||
pep8._main() # pylint: disable=W0212
|
||||
pep8._main()
|
||||
finally:
|
||||
if len(_missingImport) > 0:
|
||||
print >> sys.stderr, ("%i imports missing in this test environment"
|
||||
|
@ -23,7 +23,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import string # pylint: disable=W0402
|
||||
import string
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
@ -306,7 +306,7 @@ class UserDataHandler(object):
|
||||
blob = "\n".join(lines)
|
||||
return blob.strip()
|
||||
|
||||
def get_data(self, params, who, **kwargs): # pylint: disable=W0613
|
||||
def get_data(self, params, who, **kwargs):
|
||||
if not params:
|
||||
return self._get_user_blob(who=who)
|
||||
return NOT_IMPL_RESPONSE
|
||||
@ -427,8 +427,8 @@ def extract_opts():
|
||||
|
||||
|
||||
def setup_fetchers(opts):
|
||||
global meta_fetcher # pylint: disable=W0603
|
||||
global user_fetcher # pylint: disable=W0603
|
||||
global meta_fetcher
|
||||
global user_fetcher
|
||||
meta_fetcher = MetaDataHandler(opts)
|
||||
user_fetcher = UserDataHandler(opts)
|
||||
|
||||
|
@ -13,7 +13,7 @@ else
|
||||
base=`pwd`/tools/
|
||||
fi
|
||||
|
||||
IGNORE="E501" # Line too long (these are caught by pylint)
|
||||
IGNORE=""
|
||||
|
||||
# King Arthur: Be quiet! ... Be Quiet! I Order You to Be Quiet.
|
||||
IGNORE="$IGNORE,E121" # Continuation line indentation is not a multiple of four
|
||||
|
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
files=( bin/cloud-init $(find * -name "*.py" -type f) )
|
||||
else
|
||||
files=( "$@" );
|
||||
fi
|
||||
|
||||
RC_FILE="pylintrc"
|
||||
if [ ! -f $RC_FILE ]; then
|
||||
RC_FILE="../pylintrc"
|
||||
fi
|
||||
|
||||
cmd=(
|
||||
pylint
|
||||
--rcfile=$RC_FILE
|
||||
--disable=R
|
||||
--disable=I
|
||||
--dummy-variables-rgx="_"
|
||||
"${files[@]}"
|
||||
)
|
||||
|
||||
echo -e "\nRunning pylint:"
|
||||
echo "${cmd[@]}"
|
||||
"${cmd[@]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user