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