Skip to content

Commit

Permalink
Bump pylint to 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Apr 26, 2021
1 parent 2120c36 commit 411401e
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 40 deletions.
13 changes: 5 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[MESSAGES CONTROL]
# For all codes, run 'pylint --list-msgs' or go to 'http://pylint-messages.wikidot.com/all-codes'
disable=
invalid-name,
cyclic-import,
fixme,
import-outside-toplevel,
invalid-name,
missing-docstring,
too-many-arguments,
raise-missing-from,
too-few-public-methods,
cyclic-import,
useless-object-inheritance,
useless-import-alias,
useless-suppression,
import-outside-toplevel,
wrong-import-order
too-many-arguments,

[TYPECHECK]
# For Azure CLI extensions, we ignore some import errors as they'll be available in the environment of the CLI
Expand Down
4 changes: 2 additions & 2 deletions azdev/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def load_command_table(self, args):
from azdev.commands import load_command_table

load_command_table(self, args)
return super(AzDevCommandsLoader, self).load_command_table(args)
return super().load_command_table(args)

def load_arguments(self, command):
from azdev.params import load_arguments

load_arguments(self, command)
super(AzDevCommandsLoader, self).load_arguments(command)
super().load_arguments(command)


def main():
Expand Down
2 changes: 1 addition & 1 deletion azdev/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# TODO: import from Knack once it is moved
# pylint: disable=too-few-public-methods
class Completer(object):
class Completer:

def __init__(self, func):
self.func = func
Expand Down
5 changes: 2 additions & 3 deletions azdev/operations/extensions/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ def _get_azext_metadata(ext_dir):
def get_ext_metadata(ext_dir, ext_file, ext_name):
# Modification of https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/extension.py#L89
WHL_METADATA_FILENAME = 'metadata.json'
zip_ref = zipfile.ZipFile(ext_file, 'r')
zip_ref.extractall(ext_dir)
zip_ref.close()
with zipfile.ZipFile(ext_file, 'r') as zip_ref:
zip_ref.extractall(ext_dir)
metadata = {}
dist_info_dirs = [f for f in os.listdir(ext_dir) if f.endswith('.dist-info')]
azext_metadata = _get_azext_metadata(ext_dir)
Expand Down
6 changes: 3 additions & 3 deletions azdev/operations/linter/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_ordered_members():
return sorted(LinterSeverity, key=lambda sev: sev.value)


class Linter(object): # pylint: disable=too-many-public-methods
class Linter: # pylint: disable=too-many-public-methods
def __init__(self, command_loader=None, help_file_entries=None, loaded_help=None):
self._all_yaml_help = help_file_entries
self._loaded_help = loaded_help
Expand Down Expand Up @@ -169,7 +169,7 @@ def _get_loaded_help_description(self, entry):


# pylint: disable=too-many-instance-attributes
class LinterManager(object):
class LinterManager:

_RULE_TYPES = {'help_file_entries', 'command_groups', 'commands', 'params'}

Expand Down Expand Up @@ -323,7 +323,7 @@ class RuleError(Exception):
pass # pylint: disable=unnecessary-pass


class LinterScope(object):
class LinterScope:
"""
Linter Context manager. used when calling a rule function. Allows substitution of main linter for a linter
that takes into account any applicable exclusions, if applicable.
Expand Down
2 changes: 1 addition & 1 deletion azdev/operations/linter/rule_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .linter import RuleError, LinterSeverity


class BaseRule(object):
class BaseRule:

def __init__(self, severity):
if severity not in LinterSeverity:
Expand Down
1 change: 1 addition & 0 deletions azdev/operations/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def benchmark(commands=None, runs=20):
for raw_command in commands:
logger.info("Measuring %s...", raw_command)

# pylint: disable=consider-using-with
pool = multiprocessing.Pool(multiprocessing.cpu_count(), _benchmark_process_pool_init)

# try/except like this because of a bug of Python multiprocessing.Pool (https://bugs.python.org/issue8296)
Expand Down
2 changes: 1 addition & 1 deletion azdev/operations/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = get_logger(__name__)


class Data(object):
class Data:
def __init__(self, **kw):
self.__dict__.update(kw)
if 'properties' in self.__dict__:
Expand Down
2 changes: 1 addition & 1 deletion azdev/operations/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def run(paths, rcfile, desc, checkers=None, env=None, disable_all=False, enable=
return None
logger.debug("Using rcfile file: %s", rcfile)
logger.debug("Running on %s: %s", desc, "\n".join(paths))
command = "pylint {} --ignore vendored_sdks,privates --rcfile={} -j {}".format(
command = "pylint {} --ignore vendored_sdks,privates --rcfile={} --jobs {}".format(
" ".join(paths), rcfile, multiprocessing.cpu_count()
)
if checkers is not None:
Expand Down
26 changes: 13 additions & 13 deletions azdev/operations/tests/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def test_benchmark_with_zero_runs(self):
# """

# with mock.patch(
# "multiprocessing.pool.Pool.map_async", # pylint: disable=bad-continuation
# lambda self, _, iterable, chunksize=None, callback=None, error_callback=None: _MockedMapResultCounter( # pylint: disable=bad-continuation
# "multiprocessing.pool.Pool.map_async",
# lambda self, _, iterable, chunksize=None, callback=None, error_callback=None: _MockedMapResultCounter(
# _, iterable,
# ),
# ):
Expand All @@ -142,13 +142,13 @@ def test_benchmark_with_zero_runs(self):

def test_benchmark_with_help_command(self):
with mock.patch(
"azdev.operations.performance._benchmark_cmd_timer", # pylint: disable=bad-continuation
return_value=1, # pylint: disable=bad-continuation
"azdev.operations.performance._benchmark_cmd_timer",
return_value=1,
), mock.patch(
"multiprocessing.pool.Pool.map_async",
lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult(
func, iterable
), # pylint: disable=bad-continuation
),
):

commands = ["network applicaiton-gateway create -h", "version", "find"]
Expand All @@ -158,8 +158,8 @@ def test_benchmark_with_help_command(self):

def test_benchmark_in_actual_running(self):
with mock.patch(
"multiprocessing.pool.Pool.map_async", # pylint: disable=bad-continuation
lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult( # pylint: disable=bad-continuation
"multiprocessing.pool.Pool.map_async",
lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult(
func, iterable
),
):
Expand All @@ -182,8 +182,8 @@ def test_benchmark_in_actual_running(self):

def test_benchmark_with_specific_runs(self):
with mock.patch(
"multiprocessing.pool.Pool.map_async", # pylint: disable=bad-continuation
lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult( # pylint: disable=bad-continuation
"multiprocessing.pool.Pool.map_async",
lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult(
func, iterable
),
):
Expand All @@ -207,11 +207,11 @@ def test_benchmark_with_specific_runs(self):
# time.sleep(2)

# with mock.patch(
# "azdev.operations.performance._benchmark_cmd_timer", # pylint: disable=bad-continuation
# side_effect=mocked_benchmark_timeout_func, # pylint: disable=bad-continuation
# "azdev.operations.performance._benchmark_cmd_timer",
# side_effect=mocked_benchmark_timeout_func,
# ), mock.patch(
# "multiprocessing.pool.Pool.map_async", # pylint: disable=bad-continuation
# lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult( # pylint: disable=bad-continuation
# "multiprocessing.pool.Pool.map_async",
# lambda self, func, iterable, chunksize=None, callback=None, error_callback=None: _MockedPoolMapResult(
# func, iterable
# ),
# ):
Expand Down
2 changes: 1 addition & 1 deletion azdev/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from azdev.operations.linter import linter_severity_choices


class Flag(object):
class Flag:
""" Place holder to be used for optionals that take 0 or more arguments """


Expand Down
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,21 @@
'azdev.utilities',
],
install_requires=[
'azure-multiapi-storage',
'docutils',
'flake8',
'gitpython',
'jinja2',
'knack',
'mock',
'pylint==2.3.0',
'astroid==2.4.2', # pylint 2.3 doesn't support astroid 2.5
'pylint==2.8.0',
'pytest-xdist', # depends on pytest-forked
'pytest>=5.0.0',
'pytest-xdist', # depends on pytest-forked
'pyyaml',
'requests',
'sphinx==1.6.7',
'tox',
'wheel==0.30.0',
'azure-multiapi-storage',
'isort==4.3.21'
'wheel==0.30.0'
],
package_data={
'azdev.config': ['*.*', 'cli_pylintrc', 'ext_pylintrc'],
Expand Down

0 comments on commit 411401e

Please sign in to comment.