提交 4e595817 编写于 作者: R Roger A. Light

Merge branch 'cclauss-isort' into 1.6.x

......@@ -12,7 +12,7 @@ jobs:
- run: codespell || true # --ignore-words-list="" --skip=""
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=29 --max-line-length=167 --show-source --statistics
- run: isort --check-only --profile black . || true
- run: isort --check-only --profile black .
- run: pip install -e .
- run: mypy --ignore-missing-imports . || true
- run: mv setup.cfg setup.cfg.disabled
......
......@@ -15,10 +15,12 @@
# This shows a simple example of standard logging with an MQTT subscriber client.
import logging
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
import logging
logging.basicConfig(level=logging.DEBUG)
# If you want to use a specific client id, use
......
......@@ -17,10 +17,11 @@
# This shows an example of an MQTT client that clears all of the retained messages it receives.
import sys
import getopt
import sys
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
final_mid = 0
......
......@@ -18,6 +18,7 @@
# This shows a simple example of waiting for a message to be published.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
......
......@@ -15,12 +15,13 @@
# This shows a example of an MQTT publisher with the ability to use
# user name, password CA certificates based on command line arguments
import paho.mqtt.client as mqtt
import argparse
import os
import ssl
import argparse
import time
import paho.mqtt.client as mqtt
parser = argparse.ArgumentParser()
parser.add_argument('-H', '--host', required=False, default="mqtt.eclipseprojects.io")
......
......@@ -17,10 +17,12 @@
# This shows an example of an MQTTv5 Remote Procedure Call (RPC) client.
import context # Ensures paho is in PYTHONPATH
import json
import sys
import time
import json
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
from paho.mqtt.packettypes import PacketTypes
......
......@@ -18,6 +18,7 @@
# This demonstrates the session present flag when connecting.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
......
......@@ -16,8 +16,10 @@
# This example shows how you can use the MQTT client in a class.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
class MyMQTTClass(mqtt.Client):
def on_connect(self, mqttc, obj, flags, rc):
......
......@@ -17,6 +17,7 @@
# This shows a simple example of an MQTT subscriber using a per-subscription message handler.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
......
......@@ -18,8 +18,10 @@
# This shows a simple example of an MQTT subscriber using connect_srv method.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
def on_connect(mqttc, obj, flags, rc):
print("Connected to %s:%s" % (mqttc._host, mqttc._port))
......
......@@ -18,8 +18,10 @@
# This shows a simple example of an MQTT subscriber.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
def on_connect(mqttc, obj, flags, rc):
print("rc: "+str(rc))
......
......@@ -18,6 +18,7 @@
# This shows a simple example of an MQTT subscriber.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
......
......@@ -15,10 +15,11 @@
# This shows a example of an MQTT subscriber with the ability to use
# user name, password CA certificates based on command line arguments
import paho.mqtt.client as mqtt
import argparse
import os
import ssl
import argparse
import paho.mqtt.client as mqtt
parser = argparse.ArgumentParser()
......
......@@ -7,9 +7,9 @@ try:
except ImportError:
# This part is only required to run the examples from within the examples
# directory when the module itself is not installed.
import sys
import os
import inspect
import os
import sys
cmd_subfolder = os.path.realpath(
os.path.abspath(
......
#!/usr/bin/env python3
import asyncio
import socket
import uuid
import paho.mqtt.client as mqtt
import asyncio
client_id = 'paho-mqtt-python/issue72/' + str(uuid.uuid4())
topic = client_id
......
......@@ -2,10 +2,11 @@
import socket
import uuid
import paho.mqtt.client as mqtt
from select import select
from time import time
import paho.mqtt.client as mqtt
client_id = 'paho-mqtt-python/issue72/' + str(uuid.uuid4())
topic = client_id
print("Using client_id / topic: " + client_id)
......
......@@ -2,9 +2,11 @@
import socket
import uuid
import paho.mqtt.client as mqtt
import trio
import paho.mqtt.client as mqtt
client_id = 'paho-mqtt-python/issue72/' + str(uuid.uuid4())
topic = client_id
print("Using client_id / topic: " + client_id)
......
......@@ -16,6 +16,7 @@
# This shows an example of using the publish.multiple helper function.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.publish as publish
msgs = [{'topic': "paho/test/multiple", 'payload': "multiple 1"}, ("paho/test/multiple", "multiple 2", 0, False)]
......
......@@ -16,6 +16,7 @@
# This shows an example of using the publish.single helper function.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.publish as publish
publish.single("paho/test/single", "boo", hostname="mqtt.eclipseprojects.io")
......@@ -16,6 +16,7 @@
# This shows an example of using the publish.single helper function with unicode topic and payload.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.publish as publish
topic = u"paho/test/single/ô"
......
......@@ -17,8 +17,10 @@
# This shows an example of an MQTTv5 Remote Procedure Call (RPC) server.
import context # Ensures paho is in PYTHONPATH
import json
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.client as mqtt
from paho.mqtt.packettypes import PacketTypes
......
......@@ -16,8 +16,10 @@
# This shows an example of using the subscribe.callback helper function.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.subscribe as subscribe
def print_msg(client, userdata, message):
print("%s : %s" % (message.topic, message.payload))
......
......@@ -16,6 +16,7 @@
# This shows an example of using the subscribe.simple helper function.
import context # Ensures paho is in PYTHONPATH
import paho.mqtt.subscribe as subscribe
topics = ['#']
......
......@@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
from setuptools import find_packages, setup
sys.path.insert(0, 'src')
from paho.mqtt import __version__
......
......@@ -13,19 +13,21 @@
# Roger Light - initial API and implementation
# Ian Craggs - MQTT V5 support
from .subscribeoptions import SubscribeOptions
from .reasoncodes import ReasonCodes
from .properties import Properties
from .matcher import MQTTMatcher
import logging
import base64
import hashlib
import logging
import string
import base64
import uuid
import time
import threading
import sys
import struct
import sys
import threading
import time
import uuid
from .matcher import MQTTMatcher
from .properties import Properties
from .reasoncodes import ReasonCodes
from .subscribeoptions import SubscribeOptions
"""
This is an MQTT client module. MQTT is a lightweight pub/sub messaging
protocol that is easy to implement and suitable for low powered devices.
......@@ -51,11 +53,12 @@ except ImportError:
try:
# Python 3
from urllib import request as urllib_dot_request
from urllib import parse as urllib_dot_parse
from urllib import request as urllib_dot_request
except ImportError:
# Python 2
import urllib as urllib_dot_request
import urlparse as urllib_dot_parse
......
......@@ -16,7 +16,8 @@
*******************************************************************
"""
import sys, struct
import struct
import sys
from .packettypes import PacketTypes
......
......@@ -21,13 +21,15 @@ broker, then disconnect and nothing else is required.
from __future__ import absolute_import
import collections
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from . import client as paho
from .. import mqtt
from . import client as paho
def _do_publish(client):
"""Internal function"""
......
......@@ -17,6 +17,7 @@
"""
import sys
from .packettypes import PacketTypes
......
......@@ -20,8 +20,9 @@ you to pass a callback for processing of messages.
"""
from __future__ import absolute_import
from . import client as paho
from .. import mqtt
from . import client as paho
def _on_connect(client, userdata, flags, rc):
"""Internal callback"""
......
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
import sys
try:
import ssl
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import subprocess
import sys
import time
from struct import *
......
#!/usr/bin/env python3
import os
import subprocess
import socket
import ssl
import subprocess
import sys
import time
from struct import *
import ssl
import paho.mqtt.client as mqtt
......
import binascii
import struct
import socket
import struct
import sys
try:
......
import inspect
import os
import sys
import time
import inspect
import unicodedata
import pytest
import paho.mqtt.client as client
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
......
......@@ -16,20 +16,20 @@
*******************************************************************
"""
import unittest
import time
import threading
import getopt
import sys
import logging
import sys
import threading
import time
import traceback
import unittest
import paho.mqtt
import paho.mqtt.client
from paho.mqtt.packettypes import PacketTypes
from paho.mqtt.properties import Properties
from paho.mqtt.reasoncodes import ReasonCodes
from paho.mqtt.subscribeoptions import SubscribeOptions
from paho.mqtt.packettypes import PacketTypes
import paho.mqtt.client
class Callbacks:
......
import base64
import re
import hashlib
import re
from collections import OrderedDict
from six.moves import socketserver
import pytest
import paho.mqtt.client as client
from six.moves import socketserver
from testsupport.broker import fake_websocket_broker
import paho.mqtt.client as client
from paho.mqtt.client import WebsocketConnectionError
from testsupport.broker import fake_websocket_broker
@pytest.fixture
......
......@@ -7,7 +7,8 @@ else:
from unittest.mock import Mock
import pytest
from paho.mqtt.client import WebsocketWrapper, WebsocketConnectionError
from paho.mqtt.client import WebsocketConnectionError, WebsocketWrapper
class TestHeaders(object):
......
import contextlib
import socket
from six.moves import socketserver
import threading
import contextlib
import pytest
from six.moves import socketserver
class FakeBroker:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册