forked from platformio/platformio-core
Some fixes for new PyLint
This commit is contained in:
@ -37,16 +37,16 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
|
||||
cmds.sort()
|
||||
return cmds
|
||||
|
||||
def get_command(self, ctx, name):
|
||||
def get_command(self, ctx, cmd_name):
|
||||
mod = None
|
||||
try:
|
||||
mod = __import__("platformio.commands." + name, None, None,
|
||||
mod = __import__("platformio.commands." + cmd_name, None, None,
|
||||
["cli"])
|
||||
except ImportError:
|
||||
try:
|
||||
return self._handle_obsolate_command(name)
|
||||
return self._handle_obsolate_command(cmd_name)
|
||||
except AttributeError:
|
||||
raise click.UsageError('No such command "%s"' % name, ctx)
|
||||
raise click.UsageError('No such command "%s"' % cmd_name, ctx)
|
||||
return mod.cli
|
||||
|
||||
@staticmethod
|
||||
|
@ -156,7 +156,7 @@ class ContentCache(object):
|
||||
found = True
|
||||
if isfile(path):
|
||||
remove(path)
|
||||
if not len(listdir(dirname(path))):
|
||||
if not listdir(dirname(path)):
|
||||
util.rmtree_(dirname(path))
|
||||
|
||||
if found and self._lock_dbindex():
|
||||
@ -228,7 +228,7 @@ class ContentCache(object):
|
||||
if not isdir(dirname(cache_path)):
|
||||
os.makedirs(dirname(cache_path))
|
||||
with open(cache_path, "wb") as fp:
|
||||
if isinstance(data, dict) or isinstance(data, list):
|
||||
if isinstance(data, (dict, list)):
|
||||
json.dump(data, fp)
|
||||
else:
|
||||
fp.write(str(data))
|
||||
|
@ -252,8 +252,7 @@ def GetActualLDScript(env):
|
||||
def VerboseAction(_, act, actstr):
|
||||
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||
return act
|
||||
else:
|
||||
return Action(act, actstr)
|
||||
return Action(act, actstr)
|
||||
|
||||
|
||||
def PioClean(env, clean_dir):
|
||||
|
@ -186,7 +186,7 @@ def MatchSourceFiles(env, src_dir, src_filter=None):
|
||||
|
||||
src_dir = env.subst(src_dir)
|
||||
src_filter = src_filter or SRC_FILTER_DEFAULT
|
||||
if isinstance(src_filter, list) or isinstance(src_filter, tuple):
|
||||
if isinstance(src_filter, (list, tuple)):
|
||||
src_filter = " ".join(src_filter)
|
||||
|
||||
matches = set()
|
||||
|
@ -295,14 +295,14 @@ def lib_builtin(storage, json_output):
|
||||
if json_output:
|
||||
return click.echo(json.dumps(items))
|
||||
|
||||
for storage in items:
|
||||
if not storage['items']:
|
||||
for storage_ in items:
|
||||
if not storage_['items']:
|
||||
continue
|
||||
click.secho(storage['name'], fg="green")
|
||||
click.echo("*" * len(storage['name']))
|
||||
click.secho(storage_['name'], fg="green")
|
||||
click.echo("*" * len(storage_['name']))
|
||||
click.echo()
|
||||
|
||||
for item in sorted(storage['items'], key=lambda i: i['name']):
|
||||
for item in sorted(storage_['items'], key=lambda i: i['name']):
|
||||
print_lib_item(item)
|
||||
|
||||
|
||||
|
@ -20,8 +20,7 @@ class PlatformioException(Exception):
|
||||
def __str__(self): # pragma: no cover
|
||||
if self.MESSAGE:
|
||||
return self.MESSAGE.format(*self.args)
|
||||
else:
|
||||
return Exception.__str__(self)
|
||||
return Exception.__str__(self)
|
||||
|
||||
|
||||
class ReturnErrorCode(PlatformioException):
|
||||
|
@ -69,8 +69,7 @@ class PackageRepoIterator(object):
|
||||
|
||||
if self.package in manifest:
|
||||
return manifest[self.package]
|
||||
else:
|
||||
return self.next()
|
||||
return self.next()
|
||||
|
||||
|
||||
class PkgRepoMixin(object):
|
||||
|
@ -63,7 +63,7 @@ class PlatformManager(BasePkgManager):
|
||||
skip_default_package=False,
|
||||
trigger_event=True,
|
||||
silent=False,
|
||||
**_): # pylint: disable=too-many-arguments
|
||||
**_): # pylint: disable=too-many-arguments, arguments-differ
|
||||
platform_dir = BasePkgManager.install(
|
||||
self, name, requirements, silent=silent)
|
||||
p = PlatformFactory.newPlatform(platform_dir)
|
||||
@ -305,9 +305,7 @@ class PlatformPackagesMixin(object):
|
||||
version = self.packages[name].get("version", "")
|
||||
if self.is_valid_requirements(version):
|
||||
return self.pm.get_package_dir(name, version)
|
||||
else:
|
||||
return self.pm.get_package_dir(*self._parse_pkg_input(name,
|
||||
version))
|
||||
return self.pm.get_package_dir(*self._parse_pkg_input(name, version))
|
||||
|
||||
def get_package_version(self, name):
|
||||
pkg_dir = self.get_package_dir(name)
|
||||
|
@ -46,7 +46,7 @@ class ProjectConfig(ConfigParser):
|
||||
|
||||
VARTPL_RE = re.compile(r"\$\{([^\.\}]+)\.([^\}]+)\}")
|
||||
|
||||
def items(self, section, **_):
|
||||
def items(self, section, **_): # pylint: disable=arguments-differ
|
||||
items = []
|
||||
for option in ConfigParser.options(self, section):
|
||||
items.append((option, self.get(section, option)))
|
||||
@ -130,10 +130,9 @@ class memoized(object):
|
||||
return self.func(*args)
|
||||
if args in self.cache:
|
||||
return self.cache[args]
|
||||
else:
|
||||
value = self.func(*args)
|
||||
self.cache[args] = value
|
||||
return value
|
||||
value = self.func(*args)
|
||||
self.cache[args] = value
|
||||
return value
|
||||
|
||||
def __repr__(self):
|
||||
'''Return the function's docstring.'''
|
||||
|
Reference in New Issue
Block a user