depot_tools: Replace pylint error numbers with symbolic names.

This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.

The purpose is to slightly improve readability of pylint
disable comments.

Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
changes/12/420412/4
Quinten Yearsley 9 years ago committed by Commit Bot
parent 442fb64cab
commit b2cc4a94da

@ -159,7 +159,7 @@ def main():
properties = None
# Bad except clauses order (HTTPError is an ancestor class of
# ClientLoginError)
# pylint: disable=E0701
# pylint: disable=bad-except-order
try:
properties = rietveld_obj.get_issue_properties(options.issue, False)
except urllib2.HTTPError as e:

@ -414,7 +414,7 @@ class ReadOnlyCheckout(object):
return self.checkout.apply_patch(
patches, post_processors or self.post_processors, verbose)
def commit(self, message, user): # pylint: disable=R0201
def commit(self, message, user): # pylint: disable=no-self-use
logging.info('Would have committed for %s with message: %s' % (
user, message))
return 'FAKE'

@ -276,7 +276,7 @@ def gen_usage(parser, command):
def main(args=None):
# Do it late so all commands are listed.
# pylint: disable=E1101
# pylint: disable=no-member
parser = OptionParser(version=__version__)
if args is None:
args = sys.argv[1:]

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Android(config_util.Config):
"""Basic Config alias for Android -> Chromium."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Breakpad(config_util.Config):
@staticmethod
def fetch_spec(props):

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Chromium(config_util.Config):
"""Basic Config class for Chromium."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class CrashpadConfig(config_util.Config):
"""Basic Config class for Crashpad."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Dart(config_util.Config):
"""Basic Config class for Dart."""

@ -4,10 +4,10 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Dartino(config_util.Config):
"""Basic Config class for Dartino."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Dart(config_util.Config):
"""Basic Config class for Dart."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class DepotTools(config_util.Config):
"""Basic Config class for DepotTools."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Chromium(config_util.Config):
"""Basic Config class for Chromium."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Infra(config_util.Config):
"""Basic Config class for the Infrastructure repositories."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class InfraInternal(config_util.Config):
"""Basic Config class for the whole set of Infrastructure repositories."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class IOS(config_util.Config):
"""Basic Config alias for iOS -> Chromium."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class IOSInternal(config_util.Config):
"""Basic Config class for Chrome on iOS."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Mojo(config_util.Config):
"""Basic Config class for Mojo."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class NaCl(config_util.Config):
"""Basic Config class for NaCl."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Naclports(config_util.Config):
"""Basic Config class for naclports."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class PdfiumConfig(config_util.Config):
"""Basic Config class for pdfium."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Skia(config_util.Config):
"""Basic Config class for the Skia repository."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class SkiaBuildbot(config_util.Config):
"""Basic Config class for the Skia Buildbot repository."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class Syzygy(config_util.Config):
"""Basic Config class for Syzygy."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class V8(config_util.Config):
"""Basic Config class for V8."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class WebRTC(config_util.Config):
"""Basic Config class for WebRTC."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class WebRTCAndroid(config_util.Config):
"""Basic Config alias for Android -> WebRTC."""

@ -4,11 +4,11 @@
import sys
import config_util # pylint: disable=F0401
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
# pylint: disable=no-init
class WebRTCIOS(config_util.Config):
"""Basic Config alias for iOS -> WebRTC."""

@ -40,7 +40,7 @@ def fix_default_encoding():
# Regenerate setdefaultencoding.
reload(sys)
# Module 'sys' has no 'setdefaultencoding' member
# pylint: disable=E1101
# pylint: disable=no-member
sys.setdefaultencoding('utf-8')
for attr in dir(locale):
if attr[0:3] != 'LC_':
@ -82,7 +82,7 @@ def fix_win_sys_argv(encoding):
return False
# These types are available on linux but not Mac.
# pylint: disable=E0611,F0401
# pylint: disable=no-name-in-module,F0401
from ctypes import byref, c_int, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import LPCWSTR, LPWSTR
@ -189,10 +189,10 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
# Loads the necessary function.
# These types are available on linux but not Mac.
# pylint: disable=E0611,F0401
# pylint: disable=no-name-in-module,F0401
from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR
from ctypes.wintypes import LPVOID # pylint: disable=E0611
from ctypes.wintypes import LPVOID # pylint: disable=no-name-in-module
self._DWORD = DWORD
self._byref = byref
@ -271,7 +271,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
def win_handle_is_a_console(handle):
"""Returns True if a Windows file handle is a handle to a console."""
# These types are available on linux but not Mac.
# pylint: disable=E0611,F0401
# pylint: disable=no-name-in-module,F0401
from ctypes import byref, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, DWORD, HANDLE
@ -304,7 +304,7 @@ def win_get_unicode_stream(stream, excepted_fileno, output_handle, encoding):
old_fileno = getattr(stream, 'fileno', lambda: None)()
if old_fileno == excepted_fileno:
# These types are available on linux but not Mac.
# pylint: disable=E0611,F0401
# pylint: disable=no-name-in-module,F0401
from ctypes import windll, WINFUNCTYPE
from ctypes.wintypes import DWORD, HANDLE

@ -746,7 +746,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
return bad_deps
# Arguments number differs from overridden method
# pylint: disable=W0221
# pylint: disable=arguments-differ
def run(self, revision_overrides, command, args, work_queue, options):
"""Runs |command| then parse the DEPS file."""
logging.info('Dependency(%s).run()' % self.name)

@ -1162,7 +1162,7 @@ class GitWrapper(SCMWrapper):
self._Fetch(options, prune=options.force)
def _Run(self, args, options, show_header=True, **kwargs):
# Disable 'unused options' warning | pylint: disable=W0613
# Disable 'unused options' warning | pylint: disable=unused-argument
kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('stdout', self.out_fh)
kwargs['filter_fn'] = self.filter

@ -1169,9 +1169,9 @@ def NumLocalCpus():
try:
import multiprocessing
return multiprocessing.cpu_count()
except NotImplementedError: # pylint: disable=W0702
except NotImplementedError: # pylint: disable=bare-except
# (UNIX) Query 'os.sysconf'.
# pylint: disable=E1101
# pylint: disable=no-member
if hasattr(os, 'sysconf') and 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
return int(os.sysconf('SC_NPROCESSORS_ONLN'))

@ -29,7 +29,7 @@ GC_AUTOPACKLIMIT = 50
GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.'
try:
# pylint: disable=E0602
# pylint: disable=undefined-variable
WinErr = WindowsError
except NameError:
class WinErr(Exception):

@ -52,7 +52,7 @@ def cherry_pick(target_branch, commit, auth_config):
])
rietveld = Rietveld(config('rietveld.server'), auth_config, author)
# pylint: disable=W0212
# pylint: disable=protected-access
output = rietveld._send(
'/upload',
payload=payload,
@ -92,7 +92,7 @@ def cherry_pick(target_branch, commit, auth_config):
('data', filename, content),
])
# pylint: disable=W0212
# pylint: disable=protected-access
print ' Uploading base file for %s:' % filename, rietveld._send(
'/%s/upload_content/%s/%s' % (issue, patchset, file_id),
payload=payload,
@ -115,14 +115,14 @@ def cherry_pick(target_branch, commit, auth_config):
('data', filename, content),
])
# pylint: disable=W0212
# pylint: disable=protected-access
print ' Uploading %s:' % filename, rietveld._send(
'/%s/upload_content/%s/%s' % (issue, patchset, file_id),
payload=payload,
content_type=content_type,
)
# pylint: disable=W0212
# pylint: disable=protected-access
print 'Finalizing upload:', rietveld._send('/%s/upload_complete/1' % issue)

@ -34,7 +34,7 @@ import webbrowser
import zlib
try:
import readline # pylint: disable=F0401,W0611
import readline # pylint: disable=import-error,W0611
except ImportError:
pass
@ -3163,7 +3163,7 @@ class ChangeDescription(object):
self._description_lines = (description or '').strip().splitlines()
@property # www.logilab.org/ticket/89786
def description(self): # pylint: disable=E0202
def description(self): # pylint: disable=method-hidden
return '\n'.join(self._description_lines)
def set_description(self, desc):
@ -3738,7 +3738,7 @@ def upload_branch_deps(cl, args):
if CMDupload(OptionParser(), args) != 0:
print('Upload failed for %s!' % dependent_branch)
failures[dependent_branch] = 1
except: # pylint: disable=W0702
except: # pylint: disable=bare-except
failures[dependent_branch] = 1
print()
finally:
@ -4156,7 +4156,7 @@ def CMDlint(parser, args):
auth_config = auth.extract_auth_config_from_options(options)
# Access to a protected member _XX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
try:
import cpplint
import cpplint_chromium
@ -4726,7 +4726,7 @@ def SendUpstream(parser, args, cmd):
revision = re.match(
'.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1)
logging.debug(output)
except: # pylint: disable=W0702
except: # pylint: disable=bare-except
if _IS_BEING_TESTED:
logging.exception('this is likely your ACTUAL cause of test failure.\n'
+ '-' * 30 + '8<' + '-' * 30)

@ -20,8 +20,8 @@ if not os.path.exists('ansi2html'):
# if it doesn't exist, run ./make_docs.sh first
sys.path.insert(0, 'ansi2html')
import ansi2html # pylint: disable=F0401, W0611
import ansi2html.converter # pylint: disable=F0401, W0611
import ansi2html # pylint: disable=import-error, W0611
import ansi2html.converter # pylint: disable=import-error, W0611
def simpleXML(string):
BRIGHT = 1

@ -46,14 +46,14 @@ import auth
from third_party import httplib2
try:
from dateutil.relativedelta import relativedelta # pylint: disable=F0401
from dateutil.relativedelta import relativedelta # pylint: disable=import-error
except ImportError:
print 'python-dateutil package required'
exit(1)
# python-keyring provides easy access to the system keyring.
try:
import keyring # pylint: disable=W0611,F0401
import keyring # pylint: disable=unused-import,F0401
except ImportError:
print 'Consider installing python-keyring'
@ -665,7 +665,7 @@ def main():
# Remove description formatting
parser.format_description = (
lambda _: parser.description) # pylint: disable=E1101
lambda _: parser.description) # pylint: disable=no-member
options, args = parser.parse_args()
options.local_user = os.environ.get('USER')

@ -338,7 +338,7 @@ def main():
auth.add_auth_options(parser)
# Remove description formatting
parser.format_description = (
lambda _: parser.description) # pylint: disable=E1101
lambda _: parser.description) # pylint: disable=no-member
options, args = parser.parse_args()
auth_config = auth.extract_auth_config_from_options(options)
if args:

@ -71,7 +71,7 @@ BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$'
def _assert_is_collection(obj):
assert not isinstance(obj, basestring)
# Module 'collections' has no 'Iterable' member
# pylint: disable=E1101
# pylint: disable=no-member
if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'):
assert (isinstance(obj, collections.Iterable) and
isinstance(obj, collections.Sized))

@ -154,7 +154,7 @@ def CheckChangeLintsClean(input_api, output_api, source_file_filter=None,
cpplint = input_api.cpplint
# Access to a protected member _XX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
cpplint._cpplint_state.ResetErrorCounts()
lint_filters = lint_filters or DEFAULT_LINT_FILTERS

@ -282,7 +282,7 @@ class InputApi(object):
know stuff about the change they're looking at.
"""
# Method could be a function
# pylint: disable=R0201
# pylint: disable=no-self-use
# File extensions that are considered source files from a style guide
# perspective. Don't modify this list from a presubmit script!
@ -401,7 +401,7 @@ class InputApi(object):
# Replace <hash_map> and <hash_set> as headers that need to be included
# with "base/containers/hash_tables.h" instead.
# Access to a protected member _XX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
self.cpplint._re_pattern_templates = [
(a, b, 'base/containers/hash_tables.h')
if header in ('<hash_map>', '<hash_set>') else (a, b, header)
@ -606,7 +606,7 @@ class AffectedFile(object):
DIFF_CACHE = _DiffCache
# Method could be a function
# pylint: disable=R0201
# pylint: disable=no-self-use
def __init__(self, path, action, repository_root, diff_cache):
self._path = path
self._action = action
@ -695,7 +695,7 @@ class AffectedFile(object):
class GitAffectedFile(AffectedFile):
"""Representation of a file in a change out of a git checkout."""
# Method 'NNN' is abstract in class 'NNN' but is not overridden
# pylint: disable=W0223
# pylint: disable=abstract-method
DIFF_CACHE = _GitDiffCache

@ -33,64 +33,91 @@ load-plugins=
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
# CHANGED:
# C0103: Invalid name ""
# C0111: Missing docstring
# C0302: Too many lines in module (N)
# I0010: Unable to consider inline option ''
# I0011: Locally disabling WNNNN
#
# R0801: Similar lines in N files
# R0901: Too many ancestors (8/7)
# R0902: Too many instance attributes (N/7)
# R0903: Too few public methods (N/2)
# R0904: Too many public methods (N/20)
# R0911: Too many return statements (N/6)
# R0912: Too many branches (N/12)
# R0913: Too many arguments (N/5)
# R0914: Too many local variables (N/15)
# R0915: Too many statements (N/50)
# R0921: Abstract class not referenced
# R0922: Abstract class is only referenced 1 times
# W0122: Use of the exec statement
# W0141: Used builtin function ''
# W0142: Used * or ** magic
# W0402: Uses of a deprecated module 'string'
# W0404: 41: Reimport 'XX' (imported line NN)
# W0511: TODO
# W0603: Using the global statement
# W0703: Catch "Exception"
# W1201: Specify string format arguments as logging function parameters
# These should get enabled, but the codebase has too many violations currently:
# bad-continuation
# anomalous-backslash-in-string
# bad-context-manager
# bad-indentation
# bad-str-strip-call
# bad-whitespace
# cell-var-from-loop
# deprecated-lambda
# eval-used
# function-redefined
# import-error
# locally-enabled
# missing-final-newline
# no-init
# no-name-in-module
# no-self-use
# not-callable
# old-style-class
# protected-access
# superfluous-parens
# super-on-old-class
# too-many-function-args
# trailing-whitespace
# unnecessary-semicolon
# unpacking-non-sequence
# unused-import
# useless-else-on-loop
#
# These should get enabled, but the codebase has too many violations currently.
# bad-continuation
# anomalous-backslash-in-string
# bad-context-manager
# bad-indentation
# bad-str-strip-call
# bad-whitespace
# cell-var-from-loop
# deprecated-lambda
# eval-used
# function-redefined
# import-error
# locally-enabled
# missing-final-newline
# no-init
# no-name-in-module
# no-self-use
# not-callable
# old-style-class
# protected-access
# superfluous-parens
# super-on-old-class
# too-many-function-args
# trailing-whitespace
# unnecessary-semicolon
# unpacking-non-sequence
# unused-import
# useless-else-on-loop
disable=C0103,C0111,C0302,I0010,I0011,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0703,W1201,bad-continuation,anomalous-backslash-in-string,bad-context-manager,bad-indentation,bad-str-strip-call,bad-whitespace,cell-var-from-loop,deprecated-lambda,eval-used,function-redefined,import-error,locally-enabled,missing-final-newline,no-init,no-name-in-module,no-self-use,not-callable,old-style-class,protected-access,superfluous-parens,super-on-old-class,too-many-function-args,trailing-whitespace,unnecessary-semicolon,unpacking-non-sequence,unused-import,useless-else-on-loop
# CHANGED:
disable=
invalid-name,
missing-docstring,
too-many-lines,
bad-inline-option,
locally-disabled,
duplicate-code,
too-many-ancestors,
too-many-instance-attributes,
too-few-public-methods,
too-many-public-methods,
too-many-return-statements,
too-many-branches,
too-many-arguments,
too-many-locals,
too-many-statements,
abstract-class-not-used,
abstract-class-little-used,
exec-used,
bad-builtin,
star-args,
deprecated-module,
reimported,
fixme,
global-statement,
broad-except,
logging-not-lazy,
bad-continuation,
anomalous-backslash-in-string,
bad-context-manager,
bad-indentation,
bad-str-strip-call,
bad-whitespace,
cell-var-from-loop,
deprecated-lambda,
eval-used,
function-redefined,
import-error,
locally-enabled,
missing-final-newline,
no-init,
no-name-in-module,
no-self-use,
not-callable,
old-style-class,
protected-access,
superfluous-parens,
super-on-old-class,
too-many-function-args,
trailing-whitespace,
unnecessary-semicolon,
unpacking-non-sequence,
unused-import,
useless-else-on-loop
[REPORTS]

@ -604,7 +604,7 @@ class JwtOAuth2Rietveld(Rietveld):
access is restricted to service accounts.
"""
# The parent__init__ is not called on purpose.
# pylint: disable=W0231
# pylint: disable=super-init-not-called
def __init__(self,
url,
client_email,
@ -718,7 +718,7 @@ class ReadOnlyRietveld(object):
if not self._get_local_changes(issue).get('closed', False) and
self._get_local_changes(issue).get('commit', True)]
def close_issue(self, issue): # pylint:disable=R0201
def close_issue(self, issue): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: closing issue %d' % issue)
ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True
@ -736,18 +736,18 @@ class ReadOnlyRietveld(object):
def get_patch(self, issue, patchset):
return self._rietveld.get_patch(issue, patchset)
def update_description(self, issue, description): # pylint:disable=R0201
def update_description(self, issue, description): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: new description for issue %d: %s' %
(issue, description))
def add_comment(self, # pylint:disable=R0201
def add_comment(self, # pylint:disable=no-self-use
issue,
message,
add_as_reviewer=False):
logging.info('ReadOnlyRietveld: posting comment "%s" to issue %d' %
(message, issue))
def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201
def set_flag(self, issue, patchset, flag, value): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' %
(flag, value, issue))
ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value
@ -756,13 +756,13 @@ class ReadOnlyRietveld(object):
for flag, value in flags.iteritems():
self.set_flag(issue, patchset, flag, value)
def trigger_try_jobs( # pylint:disable=R0201
def trigger_try_jobs( # pylint:disable=no-self-use
self, issue, patchset, reason, clobber, revision, builders_and_tests,
master=None, category='cq'):
logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
(builders_and_tests, issue))
def trigger_distributed_try_jobs( # pylint:disable=R0201
def trigger_distributed_try_jobs( # pylint:disable=no-self-use
self, issue, patchset, reason, clobber, revision, masters,
category='cq'):
logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %

@ -58,7 +58,7 @@ def kill_pid(pid):
"""Kills a process by its process id."""
try:
# Unable to import 'module'
# pylint: disable=E1101,F0401
# pylint: disable=no-member,F0401
import signal
return os.kill(pid, signal.SIGKILL)
except ImportError:
@ -72,10 +72,10 @@ def kill_win(process):
"""
try:
# Unable to import 'module'
# pylint: disable=F0401
# pylint: disable=import-error
import win32process
# Access to a protected member _handle of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
return win32process.TerminateProcess(process._handle, -1)
except ImportError:
pass
@ -261,7 +261,7 @@ class Popen(subprocess.Popen):
'Check that %s or %s exist and have execution permission.'
% (str(e), kwargs.get('cwd'), args[0]))
def _tee_threads(self, input): # pylint: disable=W0622
def _tee_threads(self, input): # pylint: disable=redefined-builtin
"""Does I/O for a process's pipes using threads.
It's the simplest and slowest implementation. Expect very slow behavior.
@ -391,7 +391,7 @@ class Popen(subprocess.Popen):
if timed_out:
self.returncode = TIMED_OUT
# pylint: disable=W0221,W0622
# pylint: disable=arguments-differ,W0622
def communicate(self, input=None, timeout=None, nag_timer=None,
nag_max=None):
"""Adds timeout and callbacks support.

@ -346,7 +346,7 @@ class GerritTestCase(unittest.TestCase):
except OSError as e:
if e.errno == errno.ECHILD:
# If gerrit shut down cleanly, os.waitpid will land here.
# pylint: disable=W0150
# pylint: disable=lost-exception
return
# If we get here, the gerrit process is still alive. Send the process
@ -357,7 +357,7 @@ class GerritTestCase(unittest.TestCase):
if e.errno == errno.ESRCH:
# os.kill raised an error because the process doesn't exist. Maybe
# gerrit shut down cleanly after all.
# pylint: disable=W0150
# pylint: disable=lost-exception
return
# Announce that gerrit didn't shut down cleanly.

@ -85,7 +85,7 @@ class OrderedSet(collections.MutableSet):
prev[2] = nxt
nxt[1] = prev
def pop(self, last=True): # pylint: disable=W0221
def pop(self, last=True): # pylint: disable=arguments-differ
if not self:
raise KeyError('set is empty')
key = self.end[1][0] if last else self.end[2][0]
@ -415,7 +415,7 @@ class GitRepo(object):
stdout = sys.stdout
stderr = sys.stderr
try:
# "multiple statements on a line" pylint: disable=C0321
# "multiple statements on a line" pylint: disable=multiple-statements
with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err:
sys.stdout = out
sys.stderr = err

@ -69,7 +69,7 @@ class TestCaseUtils(object):
diff = ([i for i in actual_members if i not in expected_members] +
[i for i in expected_members if i not in actual_members])
print >> sys.stderr, diff
# pylint: disable=E1101
# pylint: disable=no-member
self.assertEqual(actual_members, expected_members)
def setUp(self):
@ -92,7 +92,7 @@ class StdoutCheck(object):
def tearDown(self):
try:
# If sys.stdout was used, self.checkstdout() must be called.
# pylint: disable=E1101
# pylint: disable=no-member
if not sys.stdout.closed:
self.assertEquals('', sys.stdout.getvalue())
except AttributeError:
@ -102,7 +102,7 @@ class StdoutCheck(object):
def checkstdout(self, expected):
value = sys.stdout.getvalue()
sys.stdout.close()
# pylint: disable=E1101
# pylint: disable=no-member
self.assertEquals(expected, value)

@ -10,7 +10,7 @@ import os
import sys
import unittest
#import test_env # pylint: disable=W0403,W0611
#import test_env # pylint: disable=relative-import,unused-import
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),

@ -87,7 +87,7 @@ class FakeRepos(fake_repos.FakeReposBase):
return fs
# pylint: disable=R0201
# pylint: disable=no-self-use
class BaseTest(fake_repos.FakeReposTestBase):
name = 'foo'
FAKE_REPOS_CLASS = FakeRepos
@ -188,7 +188,7 @@ class GitBaseTest(BaseTest):
self.assertTrue(self.enabled)
self.previous_log = self._log()
# pylint: disable=W0221
# pylint: disable=arguments-differ
def _log(self, log_from_local_repo=False):
if log_from_local_repo:
repo_root = os.path.join(self.root_dir, self.name)
@ -231,7 +231,7 @@ class GitBaseTest(BaseTest):
patches.filenames)
# Hackish to verify _branches() internal function.
# pylint: disable=W0212
# pylint: disable=protected-access
self.assertEquals(
(['master', 'working_branch'], 'working_branch'),
co._branches())

@ -2,7 +2,7 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0212
# pylint: disable=protected-access
"""Unit tests for download_from_google_storage.py."""

@ -42,14 +42,10 @@ def strip_timestamps(value):
lines[i] = m.group(1)
return ''.join(lines)
# Access to a protected member XXX of a client class
# pylint: disable=W0212
class GCBaseTestCase(object):
def assertRaisesError(self, msg, fn, *args, **kwargs):
"""Like unittest's assertRaises() but checks for Gclient.Error."""
# pylint: disable=E1101
try:
fn(*args, **kwargs)
except gclient_scm.gclient_utils.Error, e:
@ -192,7 +188,7 @@ from :3
def checkstdout(self, expected):
value = sys.stdout.getvalue()
sys.stdout.close()
# pylint: disable=E1101
# pylint: disable=no-member
self.assertEquals(expected, strip_timestamps(value))
@staticmethod
@ -572,7 +568,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
def checkstdout(self, expected):
value = sys.stdout.getvalue()
sys.stdout.close()
# pylint: disable=E1101
# pylint: disable=no-member
self.assertEquals(expected, strip_timestamps(value))
def setUp(self):
@ -590,7 +586,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
BaseTestCase.tearDown(self)
def testGetUsableRevGit(self):
# pylint: disable=E1101
# pylint: disable=no-member
options = self.Options(verbose=True)
self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True)
@ -631,7 +627,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
).AndReturn(False)
self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
# pylint: disable=E1120
# pylint: disable=no-value-for-parameter
gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
options)
self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
@ -662,7 +658,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
).AndReturn(False)
self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
# pylint: disable=E1120
# pylint: disable=no-value-for-parameter
gclient_scm.GitWrapper._Clone(
'refs/remotes/origin/master', self.url, options
).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None,
@ -693,13 +689,13 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
def checkInStdout(self, expected):
value = sys.stdout.getvalue()
sys.stdout.close()
# pylint: disable=E1101
# pylint: disable=no-member
self.assertIn(expected, value)
def checkNotInStdout(self, expected):
value = sys.stdout.getvalue()
sys.stdout.close()
# pylint: disable=E1101
# pylint: disable=no-member
self.assertNotIn(expected, value)
def getCurrentBranch(self):

@ -52,7 +52,6 @@ class GClientSmokeBase(fake_repos.FakeReposTestBase):
(stdout, stderr) = process.communicate()
logging.debug("XXX: %s\n%s\nXXX" % (' '.join(cmd), stdout))
logging.debug("YYY: %s\n%s\nYYY" % (' '.join(cmd), stderr))
# pylint: disable=E1103
return (stdout.replace('\r\n', '\n'), stderr.replace('\r\n', '\n'),
process.returncode)
@ -565,7 +564,7 @@ class GClientSmokeGITMutates(GClientSmokeBase):
new_deps = cur_deps.replace('repo_2@%s\'' % repo_2_hash,
'repo_2@\' + Var(\'r2hash\')')
new_deps = 'vars = {\'r2hash\': \'%s\'}\n%s' % (repo_2_hash, new_deps)
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=protected-access
'DEPS': new_deps,
'origin': 'git/repo_1@3\n',
})
@ -609,7 +608,7 @@ class GClientSmokeGITMutates(GClientSmokeBase):
self.assertTree(tree)
# Make a new commit object in the origin repo, to force reset to fetch.
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=protected-access
'origin': 'git/repo_2@3\n',
})
@ -639,13 +638,13 @@ class GClientSmokeGITMutates(GClientSmokeBase):
# Create an extra commit in repo_2 and point DEPS to its hash.
cur_deps = self.FAKE_REPOS.git_hashes['repo_1'][-1][1]['DEPS']
repo_2_hash_old = self.FAKE_REPOS.git_hashes['repo_2'][1][0][:7]
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=protected-access
'last_file': 'file created in last commit',
})
repo_2_hash_new = self.FAKE_REPOS.git_hashes['repo_2'][-1][0]
new_deps = cur_deps.replace(repo_2_hash_old, repo_2_hash_new)
self.assertNotEqual(new_deps, cur_deps)
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=protected-access
'DEPS': new_deps,
'origin': 'git/repo_1@4\n',
})

@ -45,7 +45,7 @@ class SCMMock(object):
def FullUrlForRelativeUrl(self, url):
return self.url + url
# pylint: disable=R0201
# pylint: disable=no-self-use
def DoesRemoteURLMatch(self, _):
return True
@ -247,7 +247,7 @@ class GclientTest(trial_dir.TestCase):
],
[])
# Make sure __str__() works fine.
# pylint: disable=W0212
# pylint: disable=protected-access
obj.dependencies[0]._file_list.append('foo')
str_obj = str(obj)
self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))

@ -29,7 +29,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase):
def __init__(self, test_string):
self.stdout = StringIO.StringIO(test_string)
self.pid = 9284
# pylint: disable=R0201
# pylint: disable=no-self-use
def wait(self):
return 0
@ -39,7 +39,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase):
'\n________ running \'boo foo bar\' in \'bleh\'\n')
for i in test_string:
gclient_utils.sys.stdout.write(i)
# pylint: disable=E1101
# pylint: disable=no-member
subprocess2.Popen(
args,
cwd=cwd,

@ -115,7 +115,7 @@ class WatchlistsMock(object):
class CodereviewSettingsFileMock(object):
def __init__(self):
pass
# pylint: disable=R0201
# pylint: disable=no-self-use
def read(self):
return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" +
"GERRIT_HOST: True\n")
@ -142,7 +142,7 @@ def CookiesAuthenticatorMockFactory(hosts_with_creds=None, same_cookie=False):
CookiesAuthenticatorMockFactory(cookie='cookie'))
"""
class CookiesAuthenticatorMock(git_cl.gerrit_util.CookiesAuthenticator):
def __init__(self): # pylint: disable=W0231
def __init__(self): # pylint: disable=super-init-not-called
# Intentionally not calling super() because it reads actual cookie files.
pass
@classmethod

@ -741,7 +741,7 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase,
def testStatus(self):
def inner():
dictified_status = lambda: {
k: dict(v._asdict()) # pylint: disable=W0212
k: dict(v._asdict()) # pylint: disable=protected-access
for k, v in self.repo.run(self.gc.status)
}
self.repo.git('mv', 'file', 'cat')

@ -5,7 +5,7 @@
"""Unit tests for presubmit_support.py and presubmit_canned_checks.py."""
# pylint: disable=E1101,E1103
# pylint: disable=no-member,E1103
import StringIO
import functools
@ -32,7 +32,7 @@ presubmit_canned_checks = presubmit.presubmit_canned_checks
# Access to a protected member XXX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
class PresubmitTestsBase(SuperMoxTestBase):
@ -1518,7 +1518,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
"""Tests presubmit_canned_checks.py."""
def MockInputApi(self, change, committing):
# pylint: disable=R0201
# pylint: disable=no-self-use
input_api = self.mox.CreateMock(presubmit.InputApi)
input_api.cStringIO = presubmit.cStringIO
input_api.json = presubmit.json

@ -52,7 +52,7 @@ class BaseFixture(unittest.TestCase):
def setUp(self):
super(BaseFixture, self).setUp()
# Access to a protected member XX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
self.rietveld = self.TESTED_CLASS('url', None, 'email')
self.rietveld._send = self._rietveld_send
self.requests = []
@ -276,8 +276,7 @@ class RietveldTest(BaseFixture):
is_new=True)
def test_svn_properties(self):
# Line too long (N/80)
# pylint: disable=C0301
# pylint: disable=line-too-long
# To test one of these, run something like
# import json, pprint, urllib

@ -20,7 +20,7 @@ import subprocess2
# Access to a protected member XXX of a client class
# pylint: disable=W0212
# pylint: disable=protected-access
class BaseTestCase(SuperMoxTestBase):

@ -13,7 +13,7 @@ import time
import unittest
try:
import fcntl # pylint: disable=F0401
import fcntl # pylint: disable=import-error
except ImportError:
fcntl = None
@ -25,7 +25,7 @@ import subprocess2
from testing_support import auto_stub
# Method could be a function
# pylint: disable=R0201
# pylint: disable=no-self-use
# Create aliases for subprocess2 specific tests. They shouldn't be used for
@ -77,7 +77,7 @@ class DefaultsTest(auto_stub.TestCase):
results.update(kwargs)
results['args'] = args
@staticmethod
# pylint: disable=W0622
# pylint: disable=redefined-builtin
def communicate(input=None, timeout=None, nag_max=None, nag_timer=None):
return None, None
self.mock(subprocess2, 'Popen', fake_Popen)
@ -132,7 +132,7 @@ class DefaultsTest(auto_stub.TestCase):
results = self._fake_subprocess_Popen()
proc = subprocess2.Popen(['foo'], a=True)
# Cleanup code in subprocess.py needs this member to be set.
# pylint: disable=W0201
# pylint: disable=attribute-defined-outside-init
proc._child_created = None
expected = {
'args': ['foo'],
@ -236,11 +236,11 @@ class RegressionTest(BaseTestCase):
self.fail()
except ValueError:
pass
if (sys.version_info[0] * 10 + sys.version_info[1]) >= 27:
# python 2.7+
try:
# pylint: disable=E1101
# pylint: disable=no-member
subprocess.check_output(self.exe, stdout=subprocess.PIPE)
self.fail()
except ValueError:
@ -617,11 +617,11 @@ class S2Test(BaseTestCase):
'No output for 9 seconds from command:', proc.cmd_str]
self.assertEquals(w, expected)
def child_main(args):
if sys.platform == 'win32':
# Annoying, make sure the output is not translated on Windows.
# pylint: disable=E1101,F0401
# pylint: disable=no-member,import-error
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)

@ -116,7 +116,7 @@ class UploadTests(unittest.TestCase):
work_queue.put((None, None))
self.gsutil.add_expected(1, '', '') # For the first ls call.
self.gsutil.add_expected(20, '', 'Expected error message')
# pylint: disable=W0212
# pylint: disable=protected-access
upload_to_google_storage._upload_worker(
0,
work_queue,

@ -5,7 +5,7 @@
"""Unit tests for watchlists.py."""
# pylint: disable=E1103,E1120,W0212
# pylint: disable=E1103,no-value-for-parameter,protected-access
import os
import sys

Loading…
Cancel
Save