kopia lustrzana https://github.com/Yakifo/amqtt
flake8: Fix all E3xx newline warnings
rodzic
6f4b306886
commit
df2c9b8a43
|
@ -302,6 +302,7 @@ if not on_rtd: # only import and set the theme if we're building docs locally
|
||||||
html_theme = 'sphinx_rtd_theme'
|
html_theme = 'sphinx_rtd_theme'
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
# Override default css to get a larger width for local build
|
# Override default css to get a larger width for local build
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
#app.add_javascript("custom.js")
|
#app.add_javascript("custom.js")
|
||||||
app.add_stylesheet('theme_overrides.css')
|
app.add_stylesheet('theme_overrides.css')
|
||||||
|
@ -313,4 +314,4 @@ else:
|
||||||
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
|
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
|
||||||
'_static/theme_overrides.css',
|
'_static/theme_overrides.css',
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,7 +500,6 @@ class Broker:
|
||||||
self.logger.debug("%s Client disconnected" % client_session.client_id)
|
self.logger.debug("%s Client disconnected" % client_session.client_id)
|
||||||
server.release_connection()
|
server.release_connection()
|
||||||
|
|
||||||
|
|
||||||
def _init_handler(self, session, reader, writer):
|
def _init_handler(self, session, reader, writer):
|
||||||
"""
|
"""
|
||||||
Create a BrokerProtocolHandler and attach to a session
|
Create a BrokerProtocolHandler and attach to a session
|
||||||
|
|
|
@ -54,6 +54,7 @@ class ClientContext(BaseContext):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.config = None
|
self.config = None
|
||||||
|
|
||||||
|
|
||||||
base_logger = logging.getLogger(__name__)
|
base_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,7 +113,6 @@ class MQTTClient:
|
||||||
self.plugins_manager = PluginManager('hbmqtt.client.plugins', context)
|
self.plugins_manager = PluginManager('hbmqtt.client.plugins', context)
|
||||||
self.client_tasks = deque()
|
self.client_tasks = deque()
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def connect(self,
|
def connect(self,
|
||||||
uri=None,
|
uri=None,
|
||||||
|
@ -210,7 +210,6 @@ class MQTTClient:
|
||||||
yield from asyncio.sleep(delay, loop=self._loop)
|
yield from asyncio.sleep(delay, loop=self._loop)
|
||||||
nb_attempt += 1
|
nb_attempt += 1
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _do_connect(self):
|
def _do_connect(self):
|
||||||
return_code = yield from self._connect_coro()
|
return_code = yield from self._connect_coro()
|
||||||
|
|
|
@ -353,7 +353,6 @@ class ProtocolHandler:
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
self.logger.debug("Message flow cancelled")
|
self.logger.debug("Message flow cancelled")
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _reader_loop(self):
|
def _reader_loop(self):
|
||||||
self.logger.debug("%s Starting reader coro" % self.session.client_id)
|
self.logger.debug("%s Starting reader coro" % self.session.client_id)
|
||||||
|
|
|
@ -38,6 +38,7 @@ def gen_client_id():
|
||||||
gen_id += chr(random.randint(0, 74) + 48)
|
gen_id += chr(random.randint(0, 74) + 48)
|
||||||
return gen_id
|
return gen_id
|
||||||
|
|
||||||
|
|
||||||
def read_yaml_config(config_file):
|
def read_yaml_config(config_file):
|
||||||
config = None
|
config = None
|
||||||
try:
|
try:
|
||||||
|
@ -45,4 +46,4 @@ def read_yaml_config(config_file):
|
||||||
config = yaml.load(stream)
|
config = yaml.load(stream)
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
logger.error("Invalid config_file %s: %s" % (config_file, exc))
|
logger.error("Invalid config_file %s: %s" % (config_file, exc))
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -30,6 +30,7 @@ config = {
|
||||||
|
|
||||||
broker = Broker(config)
|
broker = Broker(config)
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_coro():
|
def test_coro():
|
||||||
yield from broker.start()
|
yield from broker.start()
|
||||||
|
@ -42,4 +43,4 @@ if __name__ == '__main__':
|
||||||
#formatter = "%(asctime)s :: %(levelname)s :: %(message)s"
|
#formatter = "%(asctime)s :: %(levelname)s :: %(message)s"
|
||||||
logging.basicConfig(level=logging.INFO, format=formatter)
|
logging.basicConfig(level=logging.INFO, format=formatter)
|
||||||
asyncio.get_event_loop().run_until_complete(test_coro())
|
asyncio.get_event_loop().run_until_complete(test_coro())
|
||||||
asyncio.get_event_loop().run_forever()
|
asyncio.get_event_loop().run_forever()
|
||||||
|
|
|
@ -18,6 +18,7 @@ config = {
|
||||||
}
|
}
|
||||||
C = MQTTClient(config=config)
|
C = MQTTClient(config=config)
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_coro():
|
def test_coro():
|
||||||
yield from C.connect('mqtt://test.mosquitto.org:1883/')
|
yield from C.connect('mqtt://test.mosquitto.org:1883/')
|
||||||
|
@ -29,4 +30,4 @@ def test_coro():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||||
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
||||||
asyncio.get_event_loop().run_until_complete(test_coro())
|
asyncio.get_event_loop().run_until_complete(test_coro())
|
||||||
|
|
|
@ -5,7 +5,6 @@ from hbmqtt.client import MQTTClient
|
||||||
from hbmqtt.mqtt.constants import QOS_1, QOS_2
|
from hbmqtt.mqtt.constants import QOS_1, QOS_2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# This sample shows how to publish messages to broker using different QOS
|
# This sample shows how to publish messages to broker using different QOS
|
||||||
# Debug outputs shows the message flows
|
# Debug outputs shows the message flows
|
||||||
|
@ -24,6 +23,7 @@ config = {
|
||||||
C = MQTTClient(config=config)
|
C = MQTTClient(config=config)
|
||||||
#C = MQTTClient()
|
#C = MQTTClient()
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_coro():
|
def test_coro():
|
||||||
yield from C.connect('mqtts://test.mosquitto.org/', cafile='mosquitto.org.crt')
|
yield from C.connect('mqtts://test.mosquitto.org/', cafile='mosquitto.org.crt')
|
||||||
|
@ -40,4 +40,4 @@ def test_coro():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||||
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
||||||
asyncio.get_event_loop().run_until_complete(test_coro())
|
asyncio.get_event_loop().run_until_complete(test_coro())
|
||||||
|
|
|
@ -24,6 +24,7 @@ config = {
|
||||||
C = MQTTClient(config=config)
|
C = MQTTClient(config=config)
|
||||||
#C = MQTTClient()
|
#C = MQTTClient()
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_coro():
|
def test_coro():
|
||||||
yield from C.connect('wss://test.mosquitto.org:8081/', cafile='mosquitto.org.crt')
|
yield from C.connect('wss://test.mosquitto.org:8081/', cafile='mosquitto.org.crt')
|
||||||
|
@ -40,4 +41,4 @@ def test_coro():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||||
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
||||||
asyncio.get_event_loop().run_until_complete(test_coro())
|
asyncio.get_event_loop().run_until_complete(test_coro())
|
||||||
|
|
|
@ -13,6 +13,7 @@ from hbmqtt.mqtt.constants import QOS_1, QOS_2
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def uptime_coro():
|
def uptime_coro():
|
||||||
C = MQTTClient()
|
C = MQTTClient()
|
||||||
|
@ -38,4 +39,4 @@ def uptime_coro():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
formatter = "[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||||
logging.basicConfig(level=logging.INFO, format=formatter)
|
logging.basicConfig(level=logging.INFO, format=formatter)
|
||||||
asyncio.get_event_loop().run_until_complete(uptime_coro())
|
asyncio.get_event_loop().run_until_complete(uptime_coro())
|
||||||
|
|
|
@ -214,6 +214,7 @@ class MQTTClientTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_deliver(self):
|
def test_deliver(self):
|
||||||
data = b'data'
|
data = b'data'
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_coro():
|
def test_coro():
|
||||||
try:
|
try:
|
||||||
|
|
5
tox.ini
5
tox.ini
|
@ -6,11 +6,6 @@ ignore =
|
||||||
E126, # continuation line over-indented for hanging indent (~5 warnings)
|
E126, # continuation line over-indented for hanging indent (~5 warnings)
|
||||||
E127, # continuation line over-indented for visual indent (~5 warnings)
|
E127, # continuation line over-indented for visual indent (~5 warnings)
|
||||||
E128, # continuation line under-indented for visual indent (~7 warnings)
|
E128, # continuation line under-indented for visual indent (~7 warnings)
|
||||||
E301, # expected 1 blank line, found 0 (~1 warnings)
|
|
||||||
E302, # expected 2 blank lines, found 1 (~6 warnings)
|
|
||||||
E303, # too many blank lines (2) (~5 warnings)
|
|
||||||
E305, # expected 2 blank lines after class or function definition, found 1 (~1 warnings)
|
|
||||||
E306, # expected 1 blank line before a nested definition, found 0 (~1 warnings)
|
|
||||||
E402, # module level import not at top of file (~24 warnings)
|
E402, # module level import not at top of file (~24 warnings)
|
||||||
F401, # 'x' imported but unused (~12 warnings)
|
F401, # 'x' imported but unused (~12 warnings)
|
||||||
F403, # 'from x import *' used; unable to detect undefined names (~29 warnings)
|
F403, # 'from x import *' used; unable to detect undefined names (~29 warnings)
|
||||||
|
|
Ładowanie…
Reference in New Issue