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