mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 02:27:13 +02:00
Fix PyLint warnings
This commit is contained in:
@ -144,7 +144,7 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods
|
|||||||
|
|
||||||
def registration(
|
def registration(
|
||||||
self, username, email, password, firstname, lastname
|
self, username, email, password, firstname, lastname
|
||||||
): # pylint:disable=too-many-arguments
|
): # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
try:
|
try:
|
||||||
self.fetch_authentication_token()
|
self.fetch_authentication_token()
|
||||||
except: # pylint:disable=bare-except
|
except: # pylint:disable=bare-except
|
||||||
|
@ -61,7 +61,7 @@ def CleanProject(env, fullclean=False):
|
|||||||
print("Done cleaning")
|
print("Done cleaning")
|
||||||
|
|
||||||
|
|
||||||
def AddTarget( # pylint: disable=too-many-arguments
|
def AddTarget( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
env,
|
env,
|
||||||
name,
|
name,
|
||||||
dependencies,
|
dependencies,
|
||||||
|
@ -60,7 +60,7 @@ from platformio.project.helpers import find_project_dir_above, get_project_dir
|
|||||||
type=click.Choice(DefectItem.SEVERITY_LABELS.values()),
|
type=click.Choice(DefectItem.SEVERITY_LABELS.values()),
|
||||||
)
|
)
|
||||||
@click.option("--skip-packages", is_flag=True)
|
@click.option("--skip-packages", is_flag=True)
|
||||||
def cli(
|
def cli( # pylint: disable=too-many-positional-arguments
|
||||||
environment,
|
environment,
|
||||||
project_dir,
|
project_dir,
|
||||||
project_conf,
|
project_conf,
|
||||||
|
@ -29,7 +29,7 @@ class DefectItem:
|
|||||||
SEVERITY_LOW = 4
|
SEVERITY_LOW = 4
|
||||||
SEVERITY_LABELS = {4: "low", 2: "medium", 1: "high"}
|
SEVERITY_LABELS = {4: "low", 2: "medium", 1: "high"}
|
||||||
|
|
||||||
def __init__(
|
def __init__( # pylint: disable=too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
severity,
|
severity,
|
||||||
category,
|
category,
|
||||||
|
@ -63,7 +63,7 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
@click.option("-e", "--environment", "environments", multiple=True)
|
@click.option("-e", "--environment", "environments", multiple=True)
|
||||||
@click.option("-v", "--verbose", is_flag=True)
|
@click.option("-v", "--verbose", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli( # pylint: disable=too-many-arguments, too-many-branches
|
def cli( # pylint: disable=too-many-arguments,too-many-positional-arguments, too-many-branches
|
||||||
ctx,
|
ctx,
|
||||||
src,
|
src,
|
||||||
lib,
|
lib,
|
||||||
|
@ -152,7 +152,7 @@ def cli(ctx, **options):
|
|||||||
"-f", "--force", is_flag=True, help="Reinstall/redownload library if exists"
|
"-f", "--force", is_flag=True, help="Reinstall/redownload library if exists"
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def lib_install( # pylint: disable=too-many-arguments,unused-argument
|
def lib_install( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
||||||
ctx, libraries, save, silent, interactive, force
|
ctx, libraries, save, silent, interactive, force
|
||||||
):
|
):
|
||||||
click.secho(
|
click.secho(
|
||||||
@ -210,7 +210,7 @@ def lib_uninstall(ctx, libraries, save, silent):
|
|||||||
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def lib_update( # pylint: disable=too-many-arguments
|
def lib_update( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
ctx, libraries, only_check, dry_run, silent, json_output
|
ctx, libraries, only_check, dry_run, silent, json_output
|
||||||
):
|
):
|
||||||
only_check = dry_run or only_check
|
only_check = dry_run or only_check
|
||||||
|
@ -159,7 +159,7 @@ def platform_show(ctx, platform, json_output): # pylint: disable=too-many-branc
|
|||||||
help="Reinstall/redownload dev/platform and its packages if exist",
|
help="Reinstall/redownload dev/platform and its packages if exist",
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def platform_install( # pylint: disable=too-many-arguments
|
def platform_install( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
platforms,
|
platforms,
|
||||||
with_package,
|
with_package,
|
||||||
@ -224,7 +224,7 @@ def platform_uninstall(ctx, platforms):
|
|||||||
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def platform_update( # pylint: disable=too-many-locals, too-many-arguments
|
def platform_update( # pylint: disable=too-many-locals,too-many-arguments,too-many-positional-arguments
|
||||||
ctx, platforms, only_check, dry_run, silent, json_output, **_
|
ctx, platforms, only_check, dry_run, silent, json_output, **_
|
||||||
):
|
):
|
||||||
only_check = dry_run or only_check
|
only_check = dry_run or only_check
|
||||||
|
@ -57,7 +57,7 @@ from platformio.project.options import ProjectOptions
|
|||||||
@click.option("--interface", type=click.Choice(["gdb"]))
|
@click.option("--interface", type=click.Choice(["gdb"]))
|
||||||
@click.argument("client_extra_args", nargs=-1, type=click.UNPROCESSED)
|
@click.argument("client_extra_args", nargs=-1, type=click.UNPROCESSED)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(
|
def cli( # pylint: disable=too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
project_dir,
|
project_dir,
|
||||||
project_conf,
|
project_conf,
|
||||||
@ -111,7 +111,9 @@ def cli(
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _configure(ctx, project_config, env_name, load_mode, verbose, client_extra_args):
|
def _configure(
|
||||||
|
ctx, project_config, env_name, load_mode, verbose, client_extra_args
|
||||||
|
): # pylint: disable=too-many-positional-arguments
|
||||||
platform = PlatformFactory.from_env(env_name, autoinstall=True)
|
platform = PlatformFactory.from_env(env_name, autoinstall=True)
|
||||||
debug_config = DebugConfigFactory.new(
|
debug_config = DebugConfigFactory.new(
|
||||||
platform,
|
platform,
|
||||||
|
@ -76,7 +76,7 @@ def get_default_debug_env(config):
|
|||||||
|
|
||||||
def predebug_project(
|
def predebug_project(
|
||||||
ctx, project_dir, project_config, env_name, preload, verbose
|
ctx, project_dir, project_config, env_name, preload, verbose
|
||||||
): # pylint: disable=too-many-arguments
|
): # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
debug_testname = project_config.get("env:" + env_name, "debug_test")
|
debug_testname = project_config.get("env:" + env_name, "debug_test")
|
||||||
if debug_testname:
|
if debug_testname:
|
||||||
test_names = list_test_names(project_config)
|
test_names = list_test_names(project_config)
|
||||||
|
@ -89,7 +89,7 @@ def is_serial_port_ready(port, timeout=1):
|
|||||||
|
|
||||||
|
|
||||||
class SerialPortFinder:
|
class SerialPortFinder:
|
||||||
def __init__( # pylint: disable=too-many-arguments
|
def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
board_config=None,
|
board_config=None,
|
||||||
upload_protocol=None,
|
upload_protocol=None,
|
||||||
|
@ -82,7 +82,7 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
help="Do not show interactive prompt",
|
help="Do not show interactive prompt",
|
||||||
hidden=True,
|
hidden=True,
|
||||||
)
|
)
|
||||||
def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals
|
def package_publish_cmd( # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals
|
||||||
package, owner, typex, released_at, private, notify, no_interactive, non_interactive
|
package, owner, typex, released_at, private, notify, no_interactive, non_interactive
|
||||||
):
|
):
|
||||||
click.secho("Preparing a package...", fg="cyan")
|
click.secho("Preparing a package...", fg="cyan")
|
||||||
|
@ -38,7 +38,7 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
|
|||||||
def manifest_names(self):
|
def manifest_names(self):
|
||||||
return PackageType.get_manifest_map()[PackageType.PLATFORM]
|
return PackageType.get_manifest_map()[PackageType.PLATFORM]
|
||||||
|
|
||||||
def install( # pylint: disable=arguments-differ,too-many-arguments
|
def install( # pylint: disable=arguments-differ,too-many-arguments,too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
spec,
|
spec,
|
||||||
skip_dependencies=False,
|
skip_dependencies=False,
|
||||||
|
@ -196,7 +196,7 @@ class PackageOutdatedResult:
|
|||||||
|
|
||||||
|
|
||||||
class PackageSpec: # pylint: disable=too-many-instance-attributes
|
class PackageSpec: # pylint: disable=too-many-instance-attributes
|
||||||
def __init__( # pylint: disable=redefined-builtin,too-many-arguments
|
def __init__( # pylint: disable=redefined-builtin,too-many-arguments,too-many-positional-arguments
|
||||||
self, raw=None, owner=None, id=None, name=None, requirements=None, uri=None
|
self, raw=None, owner=None, id=None, name=None, requirements=None, uri=None
|
||||||
):
|
):
|
||||||
self._requirements = None
|
self._requirements = None
|
||||||
|
@ -44,7 +44,7 @@ class PlatformRunMixin:
|
|||||||
value = json.loads(value)
|
value = json.loads(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def run( # pylint: disable=too-many-arguments
|
def run( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self, variables, targets, silent, verbose, jobs
|
self, variables, targets, silent, verbose, jobs
|
||||||
):
|
):
|
||||||
assert isinstance(variables, dict)
|
assert isinstance(variables, dict)
|
||||||
|
@ -68,7 +68,7 @@ def validate_boards(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
@click.option("--no-install-dependencies", is_flag=True)
|
@click.option("--no-install-dependencies", is_flag=True)
|
||||||
@click.option("--env-prefix", default="")
|
@click.option("--env-prefix", default="")
|
||||||
@click.option("-s", "--silent", is_flag=True)
|
@click.option("-s", "--silent", is_flag=True)
|
||||||
def project_init_cmd(
|
def project_init_cmd( # pylint: disable=too-many-positional-arguments
|
||||||
project_dir,
|
project_dir,
|
||||||
boards,
|
boards,
|
||||||
ide,
|
ide,
|
||||||
|
@ -23,7 +23,7 @@ from platformio import fs
|
|||||||
from platformio.compat import IS_WINDOWS
|
from platformio.compat import IS_WINDOWS
|
||||||
|
|
||||||
|
|
||||||
class ConfigOption: # pylint: disable=too-many-instance-attributes
|
class ConfigOption: # pylint: disable=too-many-instance-attributes,too-many-positional-arguments
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
scope,
|
scope,
|
||||||
|
@ -42,7 +42,7 @@ class RegistryClient(HTTPClient):
|
|||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def publish_package( # pylint: disable=redefined-builtin
|
def publish_package( # pylint: disable=redefined-builtin, too-many-positional-arguments
|
||||||
self, owner, type, archive_path, released_at=None, private=False, notify=True
|
self, owner, type, archive_path, released_at=None, private=False, notify=True
|
||||||
):
|
):
|
||||||
with open(archive_path, "rb") as fp:
|
with open(archive_path, "rb") as fp:
|
||||||
@ -64,7 +64,7 @@ class RegistryClient(HTTPClient):
|
|||||||
x_with_authorization=True,
|
x_with_authorization=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def unpublish_package( # pylint: disable=redefined-builtin
|
def unpublish_package( # pylint: disable=redefined-builtin, too-many-positional-arguments
|
||||||
self, owner, type, name, version=None, undo=False
|
self, owner, type, name, version=None, undo=False
|
||||||
):
|
):
|
||||||
path = "/v3/packages/%s/%s/%s" % (owner, type, name)
|
path = "/v3/packages/%s/%s/%s" % (owner, type, name)
|
||||||
@ -142,7 +142,9 @@ class RegistryClient(HTTPClient):
|
|||||||
x_with_authorization=self.allowed_private_packages(),
|
x_with_authorization=self.allowed_private_packages(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_package(self, typex, owner, name, version=None, extra_path=None):
|
def get_package(
|
||||||
|
self, typex, owner, name, version=None, extra_path=None
|
||||||
|
): # pylint: disable=too-many-positional-arguments
|
||||||
try:
|
try:
|
||||||
return self.fetch_json_data(
|
return self.fetch_json_data(
|
||||||
"get",
|
"get",
|
||||||
|
@ -110,7 +110,7 @@ def remote_update(agents, only_check, dry_run):
|
|||||||
@click.option("-v", "--verbose", is_flag=True)
|
@click.option("-v", "--verbose", is_flag=True)
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def remote_run(
|
def remote_run( # pylint: disable=too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
agents,
|
agents,
|
||||||
environment,
|
environment,
|
||||||
@ -198,7 +198,7 @@ def remote_run(
|
|||||||
@click.option("--verbose", "-v", is_flag=True)
|
@click.option("--verbose", "-v", is_flag=True)
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def remote_test( # pylint: disable=redefined-builtin
|
def remote_test( # pylint: disable=redefined-builtin,too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
agents,
|
agents,
|
||||||
environment,
|
environment,
|
||||||
|
@ -239,7 +239,7 @@ class RunOrTestClient(AsyncClientBase):
|
|||||||
except (AttributeError, pb.DeadReferenceError):
|
except (AttributeError, pb.DeadReferenceError):
|
||||||
self.disconnect(exit_code=1)
|
self.disconnect(exit_code=1)
|
||||||
|
|
||||||
def cb_psync_upload_chunk_result( # pylint: disable=too-many-arguments
|
def cb_psync_upload_chunk_result( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self, result, agent_id, ac_id, dbindex, fileobj
|
self, result, agent_id, ac_id, dbindex, fileobj
|
||||||
):
|
):
|
||||||
result = PROJECT_SYNC_STAGE.lookupByValue(result)
|
result = PROJECT_SYNC_STAGE.lookupByValue(result)
|
||||||
|
@ -30,7 +30,7 @@ class SSLContextFactory(ssl.ClientContextFactory):
|
|||||||
ctx.load_verify_locations(certifi.where())
|
ctx.load_verify_locations(certifi.where())
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
def verifyHostname( # pylint: disable=unused-argument,too-many-arguments
|
def verifyHostname( # pylint: disable=unused-argument,too-many-arguments,too-many-positional-arguments
|
||||||
self, connection, x509, errno, depth, status
|
self, connection, x509, errno, depth, status
|
||||||
):
|
):
|
||||||
cn = x509.get_subject().commonName
|
cn = x509.get_subject().commonName
|
||||||
|
@ -76,7 +76,7 @@ except NotImplementedError:
|
|||||||
@click.option("-s", "--silent", is_flag=True)
|
@click.option("-s", "--silent", is_flag=True)
|
||||||
@click.option("-v", "--verbose", is_flag=True)
|
@click.option("-v", "--verbose", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(
|
def cli( # pylint: disable=too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
environment,
|
environment,
|
||||||
target,
|
target,
|
||||||
@ -174,7 +174,7 @@ def cli(
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def process_env(
|
def process_env( # pylint: disable=too-many-positional-arguments
|
||||||
ctx,
|
ctx,
|
||||||
name,
|
name,
|
||||||
config,
|
config,
|
||||||
|
@ -22,7 +22,7 @@ from platformio.test.runners.base import CTX_META_TEST_RUNNING_NAME
|
|||||||
|
|
||||||
|
|
||||||
class EnvironmentProcessor:
|
class EnvironmentProcessor:
|
||||||
def __init__( # pylint: disable=too-many-arguments
|
def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
cmd_ctx,
|
cmd_ctx,
|
||||||
name,
|
name,
|
||||||
|
@ -90,7 +90,7 @@ from platformio.test.runners.factory import TestRunnerFactory
|
|||||||
help="Increase verbosity level, maximum is 3 levels (-vvv), see docs for details",
|
help="Increase verbosity level, maximum is 3 levels (-vvv), see docs for details",
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
|
def cli( # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals,redefined-builtin
|
||||||
ctx,
|
ctx,
|
||||||
environment,
|
environment,
|
||||||
ignore,
|
ignore,
|
||||||
|
@ -55,7 +55,7 @@ class TestCaseSource:
|
|||||||
|
|
||||||
|
|
||||||
class TestCase:
|
class TestCase:
|
||||||
def __init__( # pylint: disable=too-many-arguments
|
def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
name,
|
name,
|
||||||
status,
|
status,
|
||||||
|
@ -26,7 +26,7 @@ CTX_META_TEST_RUNNING_NAME = __name__ + ".test_running_name"
|
|||||||
|
|
||||||
|
|
||||||
class TestRunnerOptions: # pylint: disable=too-many-instance-attributes
|
class TestRunnerOptions: # pylint: disable=too-many-instance-attributes
|
||||||
def __init__( # pylint: disable=too-many-arguments
|
def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
self,
|
self,
|
||||||
verbose=0,
|
verbose=0,
|
||||||
without_building=False,
|
without_building=False,
|
||||||
|
Reference in New Issue
Block a user