mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
PyLint: Fix "useless-object-inheritance"
This commit is contained in:
@ -3,16 +3,10 @@ output-format=colorized
|
|||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=
|
disable=
|
||||||
bad-continuation,
|
|
||||||
bad-whitespace,
|
|
||||||
missing-docstring,
|
missing-docstring,
|
||||||
ungrouped-imports,
|
|
||||||
invalid-name,
|
invalid-name,
|
||||||
cyclic-import,
|
|
||||||
duplicate-code,
|
|
||||||
superfluous-parens,
|
|
||||||
too-few-public-methods,
|
too-few-public-methods,
|
||||||
useless-object-inheritance,
|
superfluous-parens,
|
||||||
useless-import-alias,
|
useless-import-alias,
|
||||||
bad-option-value,
|
bad-option-value,
|
||||||
consider-using-dict-items,
|
consider-using-dict-items,
|
||||||
|
@ -70,7 +70,7 @@ SESSION_VARS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class State(object):
|
class State:
|
||||||
def __init__(self, path=None, lock=False):
|
def __init__(self, path=None, lock=False):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.lock = lock
|
self.lock = lock
|
||||||
|
@ -26,7 +26,7 @@ import click
|
|||||||
from platformio.compat import get_filesystem_encoding, get_locale_encoding
|
from platformio.compat import get_filesystem_encoding, get_locale_encoding
|
||||||
|
|
||||||
|
|
||||||
class InoToCPPConverter(object):
|
class InoToCPPConverter:
|
||||||
|
|
||||||
PROTOTYPE_RE = re.compile(
|
PROTOTYPE_RE = re.compile(
|
||||||
r"""^(
|
r"""^(
|
||||||
|
@ -46,7 +46,7 @@ from platformio.package.meta import PackageItem
|
|||||||
from platformio.project.options import ProjectOptions
|
from platformio.project.options import ProjectOptions
|
||||||
|
|
||||||
|
|
||||||
class LibBuilderFactory(object):
|
class LibBuilderFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new(env, path, verbose=int(ARGUMENTS.get("PIOVERBOSE", 0))):
|
def new(env, path, verbose=int(ARGUMENTS.get("PIOVERBOSE", 0))):
|
||||||
clsname = "UnknownLibBuilder"
|
clsname = "UnknownLibBuilder"
|
||||||
|
@ -23,7 +23,7 @@ from platformio.package.lockfile import LockFile
|
|||||||
from platformio.project.helpers import get_project_cache_dir
|
from platformio.project.helpers import get_project_cache_dir
|
||||||
|
|
||||||
|
|
||||||
class ContentCache(object):
|
class ContentCache:
|
||||||
def __init__(self, namespace=None):
|
def __init__(self, namespace=None):
|
||||||
self.cache_dir = os.path.join(get_project_cache_dir(), namespace or "content")
|
self.cache_dir = os.path.join(get_project_cache_dir(), namespace or "content")
|
||||||
self._db_path = os.path.join(self.cache_dir, "db.data")
|
self._db_path = os.path.join(self.cache_dir, "db.data")
|
||||||
|
@ -22,7 +22,7 @@ from platformio.project.helpers import get_project_dir
|
|||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
|
|
||||||
|
|
||||||
class DefectItem(object):
|
class DefectItem:
|
||||||
|
|
||||||
SEVERITY_HIGH = 1
|
SEVERITY_HIGH = 1
|
||||||
SEVERITY_MEDIUM = 2
|
SEVERITY_MEDIUM = 2
|
||||||
|
@ -18,7 +18,7 @@ from platformio.check.tools.cppcheck import CppcheckCheckTool
|
|||||||
from platformio.check.tools.pvsstudio import PvsStudioCheckTool
|
from platformio.check.tools.pvsstudio import PvsStudioCheckTool
|
||||||
|
|
||||||
|
|
||||||
class CheckToolFactory(object):
|
class CheckToolFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new(tool, project_dir, config, envname, options):
|
def new(tool, project_dir, config, envname, options):
|
||||||
cls = None
|
cls = None
|
||||||
|
@ -25,7 +25,7 @@ from platformio.package.meta import PackageSpec
|
|||||||
from platformio.project.helpers import load_build_metadata
|
from platformio.project.helpers import load_build_metadata
|
||||||
|
|
||||||
|
|
||||||
class CheckToolBase(object): # pylint: disable=too-many-instance-attributes
|
class CheckToolBase: # pylint: disable=too-many-instance-attributes
|
||||||
def __init__(self, project_dir, config, envname, options):
|
def __init__(self, project_dir, config, envname, options):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.envname = envname
|
self.envname = envname
|
||||||
|
@ -19,7 +19,7 @@ from platformio.debug.config.generic import GenericDebugConfig
|
|||||||
from platformio.debug.config.native import NativeDebugConfig
|
from platformio.debug.config.native import NativeDebugConfig
|
||||||
|
|
||||||
|
|
||||||
class DebugConfigFactory(object):
|
class DebugConfigFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_clsname(name):
|
def get_clsname(name):
|
||||||
name = re.sub(r"[^\da-z\_\-]+", "", name, flags=re.I)
|
name = re.sub(r"[^\da-z\_\-]+", "", name, flags=re.I)
|
||||||
|
@ -84,7 +84,7 @@ def list_logical_devices():
|
|||||||
|
|
||||||
|
|
||||||
def list_mdns_services():
|
def list_mdns_services():
|
||||||
class mDNSListener(object):
|
class mDNSListener:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All)
|
self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All)
|
||||||
self._found_types = []
|
self._found_types = []
|
||||||
|
@ -28,7 +28,7 @@ from platformio import exception, proc
|
|||||||
from platformio.compat import IS_WINDOWS
|
from platformio.compat import IS_WINDOWS
|
||||||
|
|
||||||
|
|
||||||
class cd(object):
|
class cd:
|
||||||
def __init__(self, new_path):
|
def __init__(self, new_path):
|
||||||
self.new_path = new_path
|
self.new_path = new_path
|
||||||
self.prev_path = os.getcwd()
|
self.prev_path = os.getcwd()
|
||||||
|
@ -29,7 +29,7 @@ from platformio.compat import get_locale_encoding, is_bytes
|
|||||||
from platformio.home import helpers
|
from platformio.home import helpers
|
||||||
|
|
||||||
|
|
||||||
class MultiThreadingStdStream(object):
|
class MultiThreadingStdStream:
|
||||||
def __init__(self, parent_stream):
|
def __init__(self, parent_stream):
|
||||||
self._buffers = {threading.get_ident(): parent_stream}
|
self._buffers = {threading.get_ident(): parent_stream}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class EndpointSession(requests.Session):
|
|||||||
return super().request(method, urljoin(self.base_url, url), *args, **kwargs)
|
return super().request(method, urljoin(self.base_url, url), *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class EndpointSessionIterator(object):
|
class EndpointSessionIterator:
|
||||||
def __init__(self, endpoints):
|
def __init__(self, endpoints):
|
||||||
if not isinstance(endpoints, list):
|
if not isinstance(endpoints, list):
|
||||||
endpoints = [endpoints]
|
endpoints = [endpoints]
|
||||||
@ -82,7 +82,7 @@ class EndpointSessionIterator(object):
|
|||||||
return session
|
return session
|
||||||
|
|
||||||
|
|
||||||
class HTTPClient(object):
|
class HTTPClient:
|
||||||
def __init__(self, endpoints):
|
def __init__(self, endpoints):
|
||||||
self._session_iter = EndpointSessionIterator(endpoints)
|
self._session_iter = EndpointSessionIterator(endpoints)
|
||||||
self._session = None
|
self._session = None
|
||||||
|
@ -79,7 +79,7 @@ def set_caller(caller=None):
|
|||||||
return app.set_session_var("caller_id", caller)
|
return app.set_session_var("caller_id", caller)
|
||||||
|
|
||||||
|
|
||||||
class Upgrader(object):
|
class Upgrader:
|
||||||
def __init__(self, from_version, to_version):
|
def __init__(self, from_version, to_version):
|
||||||
self.from_version = pepver_to_semver(from_version)
|
self.from_version = pepver_to_semver(from_version)
|
||||||
self.to_version = pepver_to_semver(to_version)
|
self.to_version = pepver_to_semver(to_version)
|
||||||
|
@ -25,7 +25,7 @@ from platformio import __default_requests_timeout__, app, fs
|
|||||||
from platformio.package.exception import PackageException
|
from platformio.package.exception import PackageException
|
||||||
|
|
||||||
|
|
||||||
class FileDownloader(object):
|
class FileDownloader:
|
||||||
def __init__(self, url, dest_dir=None):
|
def __init__(self, url, dest_dir=None):
|
||||||
self._request = None
|
self._request = None
|
||||||
# make connection
|
# make connection
|
||||||
|
@ -44,7 +44,7 @@ class LockFileTimeoutError(PlatformioException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LockFile(object):
|
class LockFile:
|
||||||
def __init__(self, path, timeout=LOCKFILE_TIMEOUT, delay=LOCKFILE_DELAY):
|
def __init__(self, path, timeout=LOCKFILE_TIMEOUT, delay=LOCKFILE_DELAY):
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
|
@ -25,7 +25,7 @@ from platformio.package.download import FileDownloader
|
|||||||
from platformio.package.lockfile import LockFile
|
from platformio.package.lockfile import LockFile
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerDownloadMixin(object):
|
class PackageManagerDownloadMixin:
|
||||||
|
|
||||||
DOWNLOAD_CACHE_EXPIRE = 86400 * 30 # keep package in a local cache for 1 month
|
DOWNLOAD_CACHE_EXPIRE = 86400 * 30 # keep package in a local cache for 1 month
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from platformio.package.unpack import FileUnpacker
|
|||||||
from platformio.package.vcsclient import VCSClientFactory
|
from platformio.package.vcsclient import VCSClientFactory
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerInstallMixin(object):
|
class PackageManagerInstallMixin:
|
||||||
|
|
||||||
_INSTALL_HISTORY = None # avoid circle dependencies
|
_INSTALL_HISTORY = None # avoid circle dependencies
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ from platformio import fs
|
|||||||
from platformio.package.meta import PackageItem, PackageSpec
|
from platformio.package.meta import PackageItem, PackageSpec
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerLegacyMixin(object):
|
class PackageManagerLegacyMixin:
|
||||||
def build_legacy_spec(self, pkg_dir):
|
def build_legacy_spec(self, pkg_dir):
|
||||||
# find src manifest
|
# find src manifest
|
||||||
src_manifest_name = ".piopkgmanager.json"
|
src_manifest_name = ".piopkgmanager.json"
|
||||||
|
@ -23,7 +23,7 @@ from platformio.registry.client import RegistryClient
|
|||||||
from platformio.registry.mirror import RegistryFileMirrorIterator
|
from platformio.registry.mirror import RegistryFileMirrorIterator
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerRegistryMixin(object):
|
class PackageManagerRegistryMixin:
|
||||||
def install_from_registry(self, spec, search_qualifiers=None):
|
def install_from_registry(self, spec, search_qualifiers=None):
|
||||||
if spec.owner and spec.name and not search_qualifiers:
|
if spec.owner and spec.name and not search_qualifiers:
|
||||||
package = self.fetch_registry_package(spec)
|
package = self.fetch_registry_package(spec)
|
||||||
|
@ -20,7 +20,7 @@ from platformio.package.exception import PackageException
|
|||||||
from platformio.package.meta import PackageItem, PackageSpec
|
from platformio.package.meta import PackageItem, PackageSpec
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerSymlinkMixin(object):
|
class PackageManagerSymlinkMixin:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_symlink(path):
|
def is_symlink(path):
|
||||||
return path and path.endswith(".pio-link") and os.path.isfile(path)
|
return path and path.endswith(".pio-link") and os.path.isfile(path)
|
||||||
|
@ -22,7 +22,7 @@ from platformio.package.exception import UnknownPackageError
|
|||||||
from platformio.package.meta import PackageItem, PackageSpec
|
from platformio.package.meta import PackageItem, PackageSpec
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerUninstallMixin(object):
|
class PackageManagerUninstallMixin:
|
||||||
def uninstall(self, spec, skip_dependencies=False):
|
def uninstall(self, spec, skip_dependencies=False):
|
||||||
try:
|
try:
|
||||||
self.lock()
|
self.lock()
|
||||||
|
@ -21,7 +21,7 @@ from platformio.package.meta import PackageItem, PackageOutdatedResult, PackageS
|
|||||||
from platformio.package.vcsclient import VCSBaseException, VCSClientFactory
|
from platformio.package.vcsclient import VCSBaseException, VCSClientFactory
|
||||||
|
|
||||||
|
|
||||||
class PackageManagerUpdateMixin(object):
|
class PackageManagerUpdateMixin:
|
||||||
def outdated(self, pkg, spec=None):
|
def outdated(self, pkg, spec=None):
|
||||||
assert isinstance(pkg, PackageItem)
|
assert isinstance(pkg, PackageItem)
|
||||||
assert pkg.metadata
|
assert pkg.metadata
|
||||||
|
@ -27,7 +27,7 @@ from platformio.package.exception import ManifestParserError, UnknownManifestErr
|
|||||||
from platformio.project.helpers import is_platformio_project
|
from platformio.project.helpers import is_platformio_project
|
||||||
|
|
||||||
|
|
||||||
class ManifestFileType(object):
|
class ManifestFileType:
|
||||||
PLATFORM_JSON = "platform.json"
|
PLATFORM_JSON = "platform.json"
|
||||||
LIBRARY_JSON = "library.json"
|
LIBRARY_JSON = "library.json"
|
||||||
LIBRARY_PROPERTIES = "library.properties"
|
LIBRARY_PROPERTIES = "library.properties"
|
||||||
@ -53,7 +53,7 @@ class ManifestFileType(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ManifestParserFactory(object):
|
class ManifestParserFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_manifest_contents(path):
|
def read_manifest_contents(path):
|
||||||
last_err = None
|
last_err = None
|
||||||
@ -139,7 +139,7 @@ class ManifestParserFactory(object):
|
|||||||
raise UnknownManifestError("Unknown manifest file type %s" % type)
|
raise UnknownManifestError("Unknown manifest file type %s" % type)
|
||||||
|
|
||||||
|
|
||||||
class BaseManifestParser(object):
|
class BaseManifestParser:
|
||||||
def __init__(self, contents, remote_url=None, package_dir=None):
|
def __init__(self, contents, remote_url=None, package_dir=None):
|
||||||
self.remote_url = remote_url
|
self.remote_url = remote_url
|
||||||
self.package_dir = package_dir
|
self.package_dir = package_dir
|
||||||
|
@ -28,7 +28,7 @@ from platformio.util import memoized
|
|||||||
|
|
||||||
|
|
||||||
class BaseSchema(Schema):
|
class BaseSchema(Schema):
|
||||||
class Meta(object): # pylint: disable=no-init
|
class Meta: # pylint: disable=no-init
|
||||||
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
||||||
|
|
||||||
def load_manifest(self, data):
|
def load_manifest(self, data):
|
||||||
@ -253,7 +253,9 @@ class ManifestSchema(BaseSchema):
|
|||||||
try:
|
try:
|
||||||
spdx = self.load_spdx_licenses()
|
spdx = self.load_spdx_licenses()
|
||||||
except requests.exceptions.RequestException as exc:
|
except requests.exceptions.RequestException as exc:
|
||||||
raise ValidationError("Could not load SPDX licenses for validation") from exc
|
raise ValidationError(
|
||||||
|
"Could not load SPDX licenses for validation"
|
||||||
|
) from exc
|
||||||
known_ids = set(item.get("licenseId") for item in spdx.get("licenses", []))
|
known_ids = set(item.get("licenseId") for item in spdx.get("licenses", []))
|
||||||
if value in known_ids:
|
if value in known_ids:
|
||||||
return True
|
return True
|
||||||
|
@ -27,7 +27,7 @@ from platformio.package.manifest.parser import ManifestFileType
|
|||||||
from platformio.package.version import cast_version_to_semver
|
from platformio.package.version import cast_version_to_semver
|
||||||
|
|
||||||
|
|
||||||
class PackageType(object):
|
class PackageType:
|
||||||
LIBRARY = "library"
|
LIBRARY = "library"
|
||||||
PLATFORM = "platform"
|
PLATFORM = "platform"
|
||||||
TOOL = "tool"
|
TOOL = "tool"
|
||||||
@ -63,7 +63,7 @@ class PackageType(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class PackageOutdatedResult(object):
|
class PackageOutdatedResult:
|
||||||
UPDATE_INCREMENT_MAJOR = "major"
|
UPDATE_INCREMENT_MAJOR = "major"
|
||||||
UPDATE_INCREMENT_MINOR = "minor"
|
UPDATE_INCREMENT_MINOR = "minor"
|
||||||
UPDATE_INCREMENT_PATCH = "patch"
|
UPDATE_INCREMENT_PATCH = "patch"
|
||||||
@ -122,7 +122,7 @@ class PackageOutdatedResult(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class PackageSpec(object): # 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
|
||||||
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
|
||||||
):
|
):
|
||||||
@ -358,7 +358,7 @@ class PackageSpec(object): # pylint: disable=too-many-instance-attributes
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
class PackageMetaData(object):
|
class PackageMetaData:
|
||||||
def __init__( # pylint: disable=redefined-builtin
|
def __init__( # pylint: disable=redefined-builtin
|
||||||
self, type, name, version, spec=None
|
self, type, name, version, spec=None
|
||||||
):
|
):
|
||||||
@ -426,7 +426,7 @@ class PackageMetaData(object):
|
|||||||
return PackageMetaData(**data)
|
return PackageMetaData(**data)
|
||||||
|
|
||||||
|
|
||||||
class PackageItem(object):
|
class PackageItem:
|
||||||
|
|
||||||
METAFILE_NAME = ".piopm"
|
METAFILE_NAME = ".piopm"
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ from platformio.package.meta import PackageItem
|
|||||||
from platformio.package.unpack import FileUnpacker
|
from platformio.package.unpack import FileUnpacker
|
||||||
|
|
||||||
|
|
||||||
class PackagePacker(object):
|
class PackagePacker:
|
||||||
INCLUDE_DEFAULT = list(ManifestFileType.items().values()) + [
|
INCLUDE_DEFAULT = list(ManifestFileType.items().values()) + [
|
||||||
"README",
|
"README",
|
||||||
"README.md",
|
"README.md",
|
||||||
|
@ -31,7 +31,7 @@ class ExtractArchiveItemError(PackageException):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BaseArchiver(object):
|
class BaseArchiver:
|
||||||
def __init__(self, arhfileobj):
|
def __init__(self, arhfileobj):
|
||||||
self._afo = arhfileobj
|
self._afo = arhfileobj
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class ZIPArchiver(BaseArchiver):
|
|||||||
self.preserve_mtime(item, dest_dir)
|
self.preserve_mtime(item, dest_dir)
|
||||||
|
|
||||||
|
|
||||||
class FileUnpacker(object):
|
class FileUnpacker:
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.path = path
|
self.path = path
|
||||||
self._archiver = None
|
self._archiver = None
|
||||||
|
@ -29,7 +29,7 @@ class VCSBaseException(PackageException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class VCSClientFactory(object):
|
class VCSClientFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new(src_dir, remote_url, silent=False):
|
def new(src_dir, remote_url, silent=False):
|
||||||
result = urlparse(remote_url)
|
result = urlparse(remote_url)
|
||||||
@ -52,10 +52,12 @@ class VCSClientFactory(object):
|
|||||||
assert isinstance(obj, VCSClientBase)
|
assert isinstance(obj, VCSClientBase)
|
||||||
return obj
|
return obj
|
||||||
except (KeyError, AssertionError) as exc:
|
except (KeyError, AssertionError) as exc:
|
||||||
raise VCSBaseException("VCS: Unknown repository type %s" % remote_url) from exc
|
raise VCSBaseException(
|
||||||
|
"VCS: Unknown repository type %s" % remote_url
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
|
||||||
class VCSClientBase(object):
|
class VCSClientBase:
|
||||||
|
|
||||||
command = None
|
command = None
|
||||||
|
|
||||||
@ -109,7 +111,9 @@ class VCSClientBase(object):
|
|||||||
subprocess.check_call(args, **kwargs)
|
subprocess.check_call(args, **kwargs)
|
||||||
return True
|
return True
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
raise VCSBaseException("VCS: Could not process command %s" % exc.cmd) from exc
|
raise VCSBaseException(
|
||||||
|
"VCS: Could not process command %s" % exc.cmd
|
||||||
|
) from exc
|
||||||
|
|
||||||
def get_cmd_output(self, args, **kwargs):
|
def get_cmd_output(self, args, **kwargs):
|
||||||
args = [self.command] + args
|
args = [self.command] + args
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
from platformio.package.meta import PackageSpec
|
from platformio.package.meta import PackageSpec
|
||||||
|
|
||||||
|
|
||||||
class PlatformPackagesMixin(object):
|
class PlatformPackagesMixin:
|
||||||
def get_package_spec(self, name, version=None):
|
def get_package_spec(self, name, version=None):
|
||||||
return PackageSpec(
|
return PackageSpec(
|
||||||
owner=self.packages[name].get("owner"),
|
owner=self.packages[name].get("owner"),
|
||||||
|
@ -27,7 +27,7 @@ from platformio.package.manager.core import get_core_package_dir
|
|||||||
from platformio.platform.exception import BuildScriptNotFound
|
from platformio.platform.exception import BuildScriptNotFound
|
||||||
|
|
||||||
|
|
||||||
class PlatformRunMixin(object):
|
class PlatformRunMixin:
|
||||||
|
|
||||||
LINE_ERROR_RE = re.compile(r"(^|\s+)error:?\s+", re.I)
|
LINE_ERROR_RE = re.compile(r"(^|\s+)error:?\s+", re.I)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from platformio.exception import UserSideException
|
|||||||
from platformio.platform.exception import InvalidBoardManifest
|
from platformio.platform.exception import InvalidBoardManifest
|
||||||
|
|
||||||
|
|
||||||
class PlatformBoardConfig(object):
|
class PlatformBoardConfig:
|
||||||
def __init__(self, manifest_path):
|
def __init__(self, manifest_path):
|
||||||
self._id = os.path.basename(manifest_path)[:-5]
|
self._id = os.path.basename(manifest_path)[:-5]
|
||||||
assert os.path.isfile(manifest_path)
|
assert os.path.isfile(manifest_path)
|
||||||
|
@ -23,7 +23,7 @@ from platformio.platform import base
|
|||||||
from platformio.platform.exception import UnknownPlatform
|
from platformio.platform.exception import UnknownPlatform
|
||||||
|
|
||||||
|
|
||||||
class PlatformFactory(object):
|
class PlatformFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_clsname(name):
|
def get_clsname(name):
|
||||||
name = re.sub(r"[^\da-z\_]+", "", name, flags=re.I)
|
name = re.sub(r"[^\da-z\_]+", "", name, flags=re.I)
|
||||||
|
@ -27,7 +27,7 @@ from platformio.compat import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AsyncPipeBase(object):
|
class AsyncPipeBase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._fd_read, self._fd_write = os.pipe()
|
self._fd_read, self._fd_write = os.pipe()
|
||||||
self._pipe_reader = os.fdopen(
|
self._pipe_reader = os.fdopen(
|
||||||
|
@ -38,7 +38,7 @@ CONFIG_HEADER = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class ProjectConfigBase(object):
|
class ProjectConfigBase:
|
||||||
|
|
||||||
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
|
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
|
||||||
VARTPL_RE = re.compile(r"\$\{([^\.\}\()]+)\.([^\}]+)\}")
|
VARTPL_RE = re.compile(r"\$\{([^\.\}\()]+)\.([^\}]+)\}")
|
||||||
@ -352,7 +352,9 @@ class ProjectConfigBase(object):
|
|||||||
except click.BadParameter as exc:
|
except click.BadParameter as exc:
|
||||||
if not self.expand_interpolations:
|
if not self.expand_interpolations:
|
||||||
return value
|
return value
|
||||||
raise exception.ProjectOptionValueError(exc.format_message(), option, section)
|
raise exception.ProjectOptionValueError(
|
||||||
|
exc.format_message(), option, section
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cast_to(value, to_type):
|
def cast_to(value, to_type):
|
||||||
@ -394,7 +396,7 @@ class ProjectConfigBase(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ProjectConfigDirsMixin(object):
|
class ProjectConfigDirsMixin:
|
||||||
def get_optional_dir(self, name):
|
def get_optional_dir(self, name):
|
||||||
"""
|
"""
|
||||||
Deprecated, used by platformio-node-helpers.project.observer.fetchLibDirs
|
Deprecated, used by platformio-node-helpers.project.observer.fetchLibDirs
|
||||||
|
@ -23,7 +23,7 @@ from platformio.proc import where_is_program
|
|||||||
from platformio.project.helpers import load_build_metadata
|
from platformio.project.helpers import load_build_metadata
|
||||||
|
|
||||||
|
|
||||||
class ProjectGenerator(object):
|
class ProjectGenerator:
|
||||||
def __init__(self, config, env_name, ide, board_ids=None):
|
def __init__(self, config, env_name, ide, board_ids=None):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.project_dir = os.path.dirname(config.path)
|
self.project_dir = os.path.dirname(config.path)
|
||||||
|
@ -24,7 +24,7 @@ from platformio import fs
|
|||||||
from platformio.compat import IS_WINDOWS, hashlib_encode_data
|
from platformio.compat import IS_WINDOWS, hashlib_encode_data
|
||||||
|
|
||||||
|
|
||||||
class ConfigOption(object): # pylint: disable=too-many-instance-attributes
|
class ConfigOption: # pylint: disable=too-many-instance-attributes
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
scope,
|
scope,
|
||||||
|
@ -21,7 +21,7 @@ from platformio.http import HTTPClient
|
|||||||
from platformio.registry.client import RegistryClient
|
from platformio.registry.client import RegistryClient
|
||||||
|
|
||||||
|
|
||||||
class RegistryFileMirrorIterator(object):
|
class RegistryFileMirrorIterator:
|
||||||
|
|
||||||
HTTP_CLIENT_INSTANCES = {}
|
HTTP_CLIENT_INSTANCES = {}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from twisted.internet import defer # pylint: disable=import-error
|
|||||||
from twisted.spread import pb # pylint: disable=import-error
|
from twisted.spread import pb # pylint: disable=import-error
|
||||||
|
|
||||||
|
|
||||||
class AsyncCommandBase(object):
|
class AsyncCommandBase:
|
||||||
|
|
||||||
MAX_BUFFER_SIZE = 1024 * 1024 # 1Mb
|
MAX_BUFFER_SIZE = 1024 * 1024 # 1Mb
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PROJECT_SYNC_STAGE(constants.Flags):
|
|||||||
COMPLETED = constants.FlagConstant()
|
COMPLETED = constants.FlagConstant()
|
||||||
|
|
||||||
|
|
||||||
class ProjectSync(object):
|
class ProjectSync:
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.path = path
|
self.path = path
|
||||||
if not isdir(self.path):
|
if not isdir(self.path):
|
||||||
|
@ -20,7 +20,7 @@ from platformio.test.runners.base import CTX_META_TEST_RUNNING_NAME
|
|||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentProcessor(object):
|
class EnvironmentProcessor:
|
||||||
def __init__( # pylint: disable=too-many-arguments
|
def __init__( # pylint: disable=too-many-arguments
|
||||||
self,
|
self,
|
||||||
cmd_ctx,
|
cmd_ctx,
|
||||||
|
@ -34,7 +34,7 @@ from platformio.proc import is_ci, is_container
|
|||||||
from platformio.project.helpers import is_platformio_project
|
from platformio.project.helpers import is_platformio_project
|
||||||
|
|
||||||
|
|
||||||
class TelemetryBase(object):
|
class TelemetryBase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._params = {}
|
self._params = {}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ class MeasurementProtocol(TelemetryBase):
|
|||||||
|
|
||||||
|
|
||||||
@util.singleton
|
@util.singleton
|
||||||
class MPDataPusher(object):
|
class MPDataPusher:
|
||||||
|
|
||||||
MAX_WORKERS = 5
|
MAX_WORKERS = 5
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ from platformio.test.result import TestSuite
|
|||||||
from platformio.test.runners.base import TestRunnerBase, TestRunnerOptions
|
from platformio.test.runners.base import TestRunnerBase, TestRunnerOptions
|
||||||
|
|
||||||
|
|
||||||
class TestRunnerFactory(object):
|
class TestRunnerFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_clsname(name):
|
def get_clsname(name):
|
||||||
name = re.sub(r"[^\da-z\_\-]+", "", name, flags=re.I)
|
name = re.sub(r"[^\da-z\_\-]+", "", name, flags=re.I)
|
||||||
|
@ -38,7 +38,7 @@ from platformio.proc import exec_command
|
|||||||
get_serialports = get_serial_ports
|
get_serialports = get_serial_ports
|
||||||
|
|
||||||
|
|
||||||
class memoized(object):
|
class memoized:
|
||||||
def __init__(self, expire=0):
|
def __init__(self, expire=0):
|
||||||
expire = str(expire)
|
expire = str(expire)
|
||||||
if expire.isdigit():
|
if expire.isdigit():
|
||||||
@ -65,7 +65,7 @@ class memoized(object):
|
|||||||
self.cache.clear()
|
self.cache.clear()
|
||||||
|
|
||||||
|
|
||||||
class throttle(object):
|
class throttle:
|
||||||
def __init__(self, threshhold):
|
def __init__(self, threshhold):
|
||||||
self.threshhold = threshhold # milliseconds
|
self.threshhold = threshhold # milliseconds
|
||||||
self.last = 0
|
self.last = 0
|
||||||
@ -97,7 +97,7 @@ class RetryStopException(RetryException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class retry(object):
|
class retry:
|
||||||
|
|
||||||
RetryNextException = RetryNextException
|
RetryNextException = RetryNextException
|
||||||
RetryStopException = RetryStopException
|
RetryStopException = RetryStopException
|
||||||
|
Reference in New Issue
Block a user