mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Resolve PyLint "import-error"
This commit is contained in:
@ -20,7 +20,10 @@ from hashlib import sha1
|
|||||||
from os.path import abspath, basename, dirname, isdir, join, splitext
|
from os.path import abspath, basename, dirname, isdir, join, splitext
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from twisted.internet import protocol, reactor, stdio, task
|
from twisted.internet import protocol # pylint: disable=import-error
|
||||||
|
from twisted.internet import reactor # pylint: disable=import-error
|
||||||
|
from twisted.internet import stdio # pylint: disable=import-error
|
||||||
|
from twisted.internet import task # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import app, exception, util
|
from platformio import app, exception, util
|
||||||
from platformio.commands.debug import helpers, initcfgs
|
from platformio.commands.debug import helpers, initcfgs
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from twisted.internet import protocol
|
from twisted.internet import protocol # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
from platformio.commands.debug import helpers
|
from platformio.commands.debug import helpers
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import os
|
import os
|
||||||
from os.path import isdir, isfile, join
|
from os.path import isdir, isfile, join
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import exception, util
|
||||||
from platformio.commands.debug import helpers
|
from platformio.commands.debug import helpers
|
||||||
|
@ -33,9 +33,11 @@ from platformio.managers.core import (get_core_package_dir,
|
|||||||
def cli(port, host, no_open):
|
def cli(port, host, no_open):
|
||||||
# import contrib modules
|
# import contrib modules
|
||||||
inject_contrib_pysite()
|
inject_contrib_pysite()
|
||||||
|
# pylint: disable=import-error
|
||||||
from autobahn.twisted.resource import WebSocketResource
|
from autobahn.twisted.resource import WebSocketResource
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.web import server
|
from twisted.web import server
|
||||||
|
# pylint: enable=import-error
|
||||||
from platformio.commands.home.rpc.handlers.app import AppRPC
|
from platformio.commands.home.rpc.handlers.app import AppRPC
|
||||||
from platformio.commands.home.rpc.handlers.ide import IDERPC
|
from platformio.commands.home.rpc.handlers.ide import IDERPC
|
||||||
from platformio.commands.home.rpc.handlers.misc import MiscRPC
|
from platformio.commands.home.rpc.handlers.misc import MiscRPC
|
||||||
|
@ -18,8 +18,9 @@ import os
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from twisted.internet import threads
|
from twisted.internet import defer # pylint: disable=import-error
|
||||||
from twisted.internet.defer import ensureDeferred
|
from twisted.internet import reactor # pylint: disable=import-error
|
||||||
|
from twisted.internet import threads # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
|
|
||||||
@ -28,7 +29,6 @@ class AsyncSession(requests.Session):
|
|||||||
|
|
||||||
def __init__(self, n=None, *args, **kwargs):
|
def __init__(self, n=None, *args, **kwargs):
|
||||||
if n:
|
if n:
|
||||||
from twisted.internet import reactor
|
|
||||||
pool = reactor.getThreadPool()
|
pool = reactor.getThreadPool()
|
||||||
pool.adjustPoolsize(0, n)
|
pool.adjustPoolsize(0, n)
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class AsyncSession(requests.Session):
|
|||||||
return threads.deferToThread(func, *args, **kwargs)
|
return threads.deferToThread(func, *args, **kwargs)
|
||||||
|
|
||||||
def wrap(self, *args, **kwargs): # pylint: disable=no-self-use
|
def wrap(self, *args, **kwargs): # pylint: disable=no-self-use
|
||||||
return ensureDeferred(*args, **kwargs)
|
return defer.ensureDeferred(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@util.memoized(expire=5000)
|
@util.memoized(expire=5000)
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from jsonrpc.exceptions import JSONRPCDispatchException
|
import jsonrpc # pylint: disable=import-error
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer # pylint: disable=import-error
|
||||||
|
|
||||||
|
|
||||||
class IDERPC(object):
|
class IDERPC(object):
|
||||||
@ -25,7 +25,7 @@ class IDERPC(object):
|
|||||||
|
|
||||||
def send_command(self, command, params):
|
def send_command(self, command, params):
|
||||||
if not self._queue:
|
if not self._queue:
|
||||||
raise JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
code=4005, message="PIO Home IDE agent is not started")
|
code=4005, message="PIO Home IDE agent is not started")
|
||||||
while self._queue:
|
while self._queue:
|
||||||
self._queue.pop().callback({
|
self._queue.pop().callback({
|
||||||
|
@ -16,8 +16,8 @@ import json
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup # pylint: disable=import-error
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import app
|
from platformio import app
|
||||||
from platformio.commands.home import helpers
|
from platformio.commands.home import helpers
|
||||||
|
@ -22,7 +22,7 @@ from functools import cmp_to_key
|
|||||||
from os.path import expanduser, isdir, isfile, join
|
from os.path import expanduser, isdir, isfile, join
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import app, util
|
from platformio import app, util
|
||||||
from platformio.commands.home import helpers
|
from platformio.commands.home import helpers
|
||||||
|
@ -19,8 +19,8 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from jsonrpc.exceptions import JSONRPCDispatchException
|
import jsonrpc # pylint: disable=import-error
|
||||||
from twisted.internet.utils import getProcessOutputAndValue
|
from twisted.internet import utils # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import __version__, util
|
from platformio import __version__, util
|
||||||
from platformio.commands.home import helpers
|
from platformio.commands.home import helpers
|
||||||
@ -37,9 +37,9 @@ class PIOCoreRPC(object):
|
|||||||
arg, util.string_types) else str(arg) for arg in args
|
arg, util.string_types) else str(arg) for arg in args
|
||||||
]
|
]
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
code=4002, message="PIO Core: non-ASCII chars in arguments")
|
code=4002, message="PIO Core: non-ASCII chars in arguments")
|
||||||
d = getProcessOutputAndValue(
|
d = utils.getProcessOutputAndValue(
|
||||||
helpers.get_core_fullpath(),
|
helpers.get_core_fullpath(),
|
||||||
args,
|
args,
|
||||||
path=(options or {}).get("cwd"),
|
path=(options or {}).get("cwd"),
|
||||||
@ -73,7 +73,7 @@ class PIOCoreRPC(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _call_errback(failure):
|
def _call_errback(failure):
|
||||||
raise JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
code=4003,
|
code=4003,
|
||||||
message="PIO Core Call Error",
|
message="PIO Core Call Error",
|
||||||
data=failure.getErrorMessage())
|
data=failure.getErrorMessage())
|
||||||
|
@ -21,7 +21,7 @@ import time
|
|||||||
from os.path import (basename, expanduser, getmtime, isdir, isfile, join,
|
from os.path import (basename, expanduser, getmtime, isdir, isfile, join,
|
||||||
realpath, sep)
|
realpath, sep)
|
||||||
|
|
||||||
from jsonrpc.exceptions import JSONRPCDispatchException
|
import jsonrpc # pylint: disable=import-error
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import exception, util
|
||||||
from platformio.commands.home.rpc.handlers.app import AppRPC
|
from platformio.commands.home.rpc.handlers.app import AppRPC
|
||||||
@ -189,7 +189,7 @@ class ProjectRPC(object):
|
|||||||
for ext in ("ino", "pde")
|
for ext in ("ino", "pde")
|
||||||
])
|
])
|
||||||
if not is_arduino_project:
|
if not is_arduino_project:
|
||||||
raise JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
code=4000,
|
code=4000,
|
||||||
message="Not an Arduino project: %s" % arduino_project_dir)
|
message="Not an Arduino project: %s" % arduino_project_dir)
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ class ProjectRPC(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def import_pio(project_dir):
|
def import_pio(project_dir):
|
||||||
if not project_dir or not util.is_platformio_project(project_dir):
|
if not project_dir or not util.is_platformio_project(project_dir):
|
||||||
raise JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
code=4001,
|
code=4001,
|
||||||
message="Not an PlatformIO project: %s" % project_dir)
|
message="Not an PlatformIO project: %s" % project_dir)
|
||||||
new_project_dir = join(
|
new_project_dir = join(
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
# pylint: disable=import-error
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import jsonrpc
|
import jsonrpc
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor # pylint: disable=import-error
|
||||||
from twisted.web import static
|
from twisted.web import static # pylint: disable=import-error
|
||||||
|
|
||||||
|
|
||||||
class WebRoot(static.File):
|
class WebRoot(static.File):
|
||||||
|
Reference in New Issue
Block a user