diff --git a/.pylintrc b/.pylintrc index 268effc..ab2dad0 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,13 +3,14 @@ # W0511 fixme # C0111 Missing docstring # C0103 Invalid %s name "%s" +# C0415 Import outside toplevel (import-outside-toplevel) # I0011 Warning locally suppressed using disable-msg # R0913 Too many arguments # R0903 too-few-public-methods # R0401 cyclic-import # R0205 useless-object-inheritance # R1717 consider-using-dict-comprehension -disable=W0511,C0111,C0103,I0011,R0913,R0903,R0401,R0205,R1717,useless-suppression +disable=W0511,C0111,C0103,C0415,I0011,R0913,R0903,R0401,R0205,R1717,useless-suppression [FORMAT] max-line-length=120 diff --git a/knack/config.py b/knack/config.py index 4ea68f2..d5ccf21 100644 --- a/knack/config.py +++ b/knack/config.py @@ -100,7 +100,7 @@ def get(self, section, option, fallback=_UNSET): def items(self, section): import re pattern = self.env_var_name(section, '.+') - candidates = [(k.split('_')[-1], os.environ[k], k) for k in os.environ.keys() if re.match(pattern, k)] + candidates = [(k.split('_')[-1], os.environ[k], k) for k in os.environ if re.match(pattern, k)] result = {c[0]: c for c in candidates} for config in self._config_file_chain if self.use_local_config else self._config_file_chain[-1:]: try: @@ -180,7 +180,7 @@ def has_option(self, section, option): def get(self, section, option): if self.config_parser: return self.config_parser.get(section, option) - raise configparser.NoOptionError(section, option) + raise configparser.NoOptionError(option, section) def getint(self, section, option): return int(self.get(section, option)) diff --git a/knack/introspection.py b/knack/introspection.py index c784181..65e045c 100644 --- a/knack/introspection.py +++ b/knack/introspection.py @@ -54,10 +54,9 @@ def option_descriptions(operation): temp = lines[index].strip() if any(temp.startswith(x) for x in param_breaks): break - else: - if temp: - arg_desc += (' ' + temp) - index += 1 + if temp: + arg_desc += (' ' + temp) + index += 1 option_descs[arg_name] = arg_desc diff --git a/knack/testsdk/base.py b/knack/testsdk/base.py index 8497ae2..42c21eb 100644 --- a/knack/testsdk/base.py +++ b/knack/testsdk/base.py @@ -179,7 +179,7 @@ def _process_response_recording(self, response): @classmethod def _custom_request_query_matcher(cls, r1, r2): """ Ensure method, path, and query parameters match. """ - from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=relative-import, useless-suppression + from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=useless-suppression url1 = urlparse(r1.uri) url2 = urlparse(r2.uri) diff --git a/requirements.txt b/requirements.txt index 267ec62..209afc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ colorama==0.4.3 flake8==3.7.9 jmespath==0.9.5 mock==4.0.1 -pylint==2.3.0 +pylint==2.5.3 Pygments==2.5.2 PyYAML==5.3.1 six==1.14.0