Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions knack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Copy link
Member Author

@jiasli jiasli Jul 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument order was wrong:

Lib\configparser.py

class NoOptionError(Error):
    """A requested option was not found."""

    def __init__(self, option, section):
        Error.__init__(self, "No option %r in section: %r" %
                       (option, section))
        self.option = option
        self.section = section
        self.args = (option, section)


def getint(self, section, option):
return int(self.get(section, option))
Expand Down
7 changes: 3 additions & 4 deletions knack/introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion knack/testsdk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down