Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove six #387

Merged
merged 2 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions azext_iot/common/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import sys
from os import linesep
import six
from six.moves import input
from knack.util import CLIError
from azext_iot.constants import EVENT_LIB, VERSION
from azext_iot.common.utility import test_import
Expand All @@ -25,13 +23,13 @@ def ensure_uamqp(config, yes=False, repair=False):
if i.lower() != 'y':
sys.exit('User has declined update...')

six.print_('Updating required dependency...')
print('Updating required dependency...')
with HomebrewPipPatch():
# The version range defined in this custom_version parameter should be stable
try:
install(EVENT_LIB[0], compatible_version='{}'.format(EVENT_LIB[1]))
update_uamqp_ext_version(config, EVENT_LIB[1])
six.print_('Update complete. Executing command...')
print('Update complete. Executing command...')
except RuntimeError as e:
six.print_('Failure updating {}. Aborting...'.format(EVENT_LIB[0]))
print('Failure updating {}. Aborting...'.format(EVENT_LIB[0]))
raise CLIError(e)
13 changes: 6 additions & 7 deletions azext_iot/operations/_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import ssl
import os
import six

from time import sleep
from paho.mqtt import client as mqtt
Expand Down Expand Up @@ -55,22 +54,22 @@ def __init__(self, target, device_id, properties=None, sas_duration=3600):
self.client.connect(host=self.target["entity"], port=8883)

def on_connect(self, client, userdata, flags, rc):
six.print_(
print(
"Connected to target IoT Hub with result: {}".format(
connection_result[rc]
)
)
self.client.subscribe(self.topic_receive)
six.print_("Subscribed to device bound message queue")
print("Subscribed to device bound message queue")
self.connected = True

def on_message(self, client, userdata, msg):
six.print_()
six.print_("_Received C2D message with topic_: {}".format(msg.topic))
six.print_("_Payload_: {}".format(msg.payload))
print()
print("_Received C2D message with topic_: {}".format(msg.topic))
print("_Payload_: {}".format(msg.payload))

def on_publish(self, client, userdata, mid):
six.print_(".", end="", flush=True)
print(".", end="", flush=True)

def is_connected(self):
return self.connected
Expand Down
17 changes: 8 additions & 9 deletions azext_iot/operations/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from os.path import exists, basename
from time import time, sleep
import six
from knack.log import get_logger
from knack.util import CLIError
from enum import Enum, EnumMeta
Expand Down Expand Up @@ -2624,7 +2623,7 @@ def generate(self, jsonify=True):
def http_wrap(target, device_id, generator):
d = generator.generate(False)
_iot_device_send_message_http(target, device_id, d, headers=properties_to_send)
six.print_(".", end="", flush=True)
print(".", end="", flush=True)

try:
if protocol_type == ProtocolType.mqtt.name:
Expand All @@ -2648,7 +2647,7 @@ def http_wrap(target, device_id, generator):
)
wrap.execute(generator(), publish_delay=msg_interval, msg_count=msg_count)
else:
six.print_("Sending and receiving events via https")
print("Sending and receiving events via https")
token, op = execute_onthread(
method=http_wrap,
args=[target, device_id, generator()],
Expand Down Expand Up @@ -2703,17 +2702,17 @@ def _iot_simulate_get_default_properties(protocol):
def _handle_c2d_msg(target, device_id, receive_settle, lock_timeout=60):
result = _iot_c2d_message_receive(target, device_id, lock_timeout)
if result:
six.print_()
six.print_("__Received C2D Message__")
six.print_(result)
print()
print("__Received C2D Message__")
print(result)
if receive_settle == "reject":
six.print_("__Rejecting message__")
print("__Rejecting message__")
_iot_c2d_message_reject(target, device_id, result["etag"])
elif receive_settle == "abandon":
six.print_("__Abandoning message__")
print("__Abandoning message__")
_iot_c2d_message_abandon(target, device_id, result["etag"])
else:
six.print_("__Completing message__")
print("__Completing message__")
_iot_c2d_message_complete(target, device_id, result["etag"])
return True
return False
Expand Down