From 947e31ca8d41bcbe7b8b0fd112b2fedc127d3b33 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 7 May 2019 23:51:46 +0300 Subject: [PATCH] Fix some PyLint errors --- .pylintrc | 33 +++++++++++---------------------- platformio/commands/upgrade.py | 3 +-- platformio/exception.py | 2 -- platformio/managers/lib.py | 2 +- platformio/util.py | 4 +--- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/.pylintrc b/.pylintrc index 82c3fb7a..180a05b8 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,23 +1,12 @@ [MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. See also the "--disable" option for examples. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -# disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating - -disable=missing-docstring,invalid-name,too-few-public-methods,redefined-variable-type,similarities,unsupported-membership-test,unsubscriptable-object,ungrouped-imports,cyclic-import,superfluous-parens,useless-object-inheritance,useless-import-alias,fixme +disable= + missing-docstring, + ungrouped-imports, + invalid-name, + cyclic-import, + duplicate-code, + superfluous-parens, + too-few-public-methods, + useless-object-inheritance, + useless-import-alias, + fixme diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index ec4fe864..c47ff8dc 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -43,11 +43,10 @@ def cli(dev): get_pip_package(to_develop)], ["platformio", "--version"]) cmd = None - r = None + r = {} try: for cmd in cmds: cmd = [util.get_pythonexe_path(), "-m"] + cmd - r = None r = util.exec_command(cmd) # try pip with disabled cache diff --git a/platformio/exception.py b/platformio/exception.py index 4c4af06f..bba8955a 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=not-an-iterable - class PlatformioException(Exception): diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index 3ca89d49..4cbb34a7 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -164,7 +164,7 @@ class LibraryManager(BasePkgManager): semver_spec = self.parse_semver_spec( requirements) if requirements else None - item = None + item = {} for v in versions: semver_new = self.parse_semver_version(v['name']) diff --git a/platformio/util.py b/platformio/util.py index 49739c14..8055cc4d 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-ancestors - import json import os import platform @@ -464,7 +462,7 @@ def _get_api_result( auth=None): from platformio.app import get_setting - result = None + result = {} r = None verify_ssl = sys.version_info >= (2, 7, 9)