Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp604257pxb; Fri, 22 Apr 2022 07:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvKEpfeG2v0hq7henf1MsucnX7/XSiMQhSwbGPULF/APvxq1hhsebYkuG9lTwwhut3yq/6 X-Received: by 2002:a05:6402:358e:b0:423:fd1c:3453 with SMTP id y14-20020a056402358e00b00423fd1c3453mr5177225edc.403.1650638602383; Fri, 22 Apr 2022 07:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650638602; cv=none; d=google.com; s=arc-20160816; b=S1XCCCmeMOS69FN5veI32y86nd8eQcFFUgZk3dnNEXLZbP7XbvVL0XicPvo6VUkHJw JG0rzL5o578vQ6hpVkLfZ+IE5lFUDsP+gbP14q4hIADGaJiqp2GRe/pFNziqrwdINnKW Vt8ZhO0tXB9svBDrRTTqyDl3Df/GjzvZ0ZcpM92QModM0LSXZJ1kGxB8sY1aMHYnTQ93 wBlskHSv+3sBRJ/7wESIV3JH0mGvSQa3cnZpxtH0MFmP0OQDLtcpigfV01issog6w973 k/h5lvl9BTDY3778bmi88UxbA3MqG3+KvjeYqgyxnQi+vsGPaunDxsB2y953N7p67STF n7ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3upJnd1aFZWxs7CUK2+oITgLbb7BGw/zMQnr9toHaSs=; b=dj3Edqb+WdVbCnsab2KFkkt1W3ilC7nbX2L9DPXtOx3jLxsLOElZCXQymj68C/fzyK qhHok70v3uwwFw55sm+jiF+1yT23TOqN3jHpDrT78MwDB77vn325lcKNko1SdyIi89FG R5QOshgRIUtSPfN2HNoXRMRx9q6BoAVk4jH+im7rS8VE11c6QXWkBQHFWKfpuvsVKC32 Wf0FS4coNjyqHzkDmg9espjAeLJFkEwRZw8kCfI54vot27peOFVeCMWC7npOtMOmv5xL J0anJMxwgilaqtb2hIZ19e8vILREsutz9XHwb3yu4LPjvQvCTBAfFyRCQAKRKg1otG+x tMtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kynetics-com.20210112.gappssmtp.com header.s=20210112 header.b=zBGFOmpZ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz10-20020a0564021d4a00b0041d7aaf8c03si6927057edb.544.2022.04.22.07.42.42; Fri, 22 Apr 2022 07:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kynetics-com.20210112.gappssmtp.com header.s=20210112 header.b=zBGFOmpZ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240224AbiDSPEg (ORCPT + 99 others); Tue, 19 Apr 2022 11:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347499AbiDSPEf (ORCPT ); Tue, 19 Apr 2022 11:04:35 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D5FC2DD73 for ; Tue, 19 Apr 2022 08:01:52 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id t11so33481337eju.13 for ; Tue, 19 Apr 2022 08:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynetics-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3upJnd1aFZWxs7CUK2+oITgLbb7BGw/zMQnr9toHaSs=; b=zBGFOmpZB+cWlaU8mtqlsamhFT3VfmItJ0tOCiErvbVASvBzoC8a3T6htC8WUEkPeO dbCODvhVjVFQ7ktEowIgO9FYvQAf/L0a86Cpxv3ueS6/RO12vJqTMQmi4a9OVjl0KoQ7 uowdsYY8oXel7L4WCs/AOFBeWbG1xZlqd1KQrZT//VevvtL2mcEsJJ5QdtF6njSCV4rs qkSI9D3P3CFggWhSSrSFBDqiitit4HDMtEHnJDrWsrf9A3BCzNBmJnAgio2r7Y4xzeqg Unin/jkt9Aerd1ZE0GPftWYtmBplqOTWsGBqML/nVao+cpW3ghe2h+AduY5LeLNls8dI LiKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3upJnd1aFZWxs7CUK2+oITgLbb7BGw/zMQnr9toHaSs=; b=gWThs+KX6779nGvmHlWXI3ZdiFq6AZVrAk2cUMQlcNsuCsNK7jxauG2h4noF2zzpBi loy9P8csxvbeeNfGKDRKgb4qCYT9h2cAeapniyz6l+ZU0JW3WvShAwYOUgWyd059wltF Prkayl0Isx+tfH4PcrjQqL09Tzbk70+duhLc5oUPMfgpPD9uDMYCn0v0qTwHNG9S+qOh LxAzRaGhaE8PIlky/N25FcBDO/LLVejRfHf8dBwcxIaSsSgSIB/DAzLjpFtsIwUSsciM JgkL9czSYTjKIjViJmPuLSxH8GubzMHjesCH+aAc+2VUsOUmjGVBIkd77TNKkeAbnYDM MZRA== X-Gm-Message-State: AOAM533w1nzSAytJGT0HuA+6c1rrCX4NDbpruDia0cRKqpEma7uWxjwx 6X//aRRHEZjbET0pRG4JFaDW6L3uIesKlA== X-Received: by 2002:a17:906:6dc4:b0:6e8:465d:65c3 with SMTP id j4-20020a1709066dc400b006e8465d65c3mr13656666ejt.179.1650380510618; Tue, 19 Apr 2022 08:01:50 -0700 (PDT) Received: from localhost.lan (217-133-17-98.static.clienti.tiscali.it. [217.133.17.98]) by smtp.gmail.com with ESMTPSA id cr10-20020a056402222a00b0041d918fdf99sm8649389edb.85.2022.04.19.08.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 08:01:50 -0700 (PDT) From: Diego Rondini To: linux-bluetooth@vger.kernel.org Cc: Diego Rondini Subject: [PATCH BlueZ] test: changes for Python3 Date: Tue, 19 Apr 2022 17:03:56 +0200 Message-Id: <20220419150356.694346-1-diego.rondini@kynetics.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NEUTRAL, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Remove some leftover usage of Python2 code. In particular replace iteritems() with items() to fix the following error: AttributeError: 'dbus.Dictionary' object has no attribute 'iteritems' --- test/list-devices | 4 ++-- test/map-client | 2 +- test/monitor-bluetooth | 6 +++--- test/test-adapter | 2 +- test/test-device | 2 +- test/test-discovery | 4 ++-- test/test-health | 4 ++-- test/test-health-sink | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/list-devices b/test/list-devices index b112556c3..618d2867b 100755 --- a/test/list-devices +++ b/test/list-devices @@ -32,10 +32,10 @@ def extract_uuids(uuid_list): objects = manager.GetManagedObjects() -all_devices = (str(path) for path, interfaces in objects.iteritems() if +all_devices = (str(path) for path, interfaces in objects.items() if "org.bluez.Device1" in interfaces.keys()) -for path, interfaces in objects.iteritems(): +for path, interfaces in objects.items(): if "org.bluez.Adapter1" not in interfaces.keys(): continue diff --git a/test/map-client b/test/map-client index a2d96ae5f..f44f512bd 100755 --- a/test/map-client +++ b/test/map-client @@ -33,7 +33,7 @@ def unwrap(x): return tuple(map(unwrap, x)) if isinstance(x, dict): - return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()]) + return dict([(unwrap(k), unwrap(v)) for k, v in x.items()]) for t in [unicode, str, long, int, float, bool]: if isinstance(x, t): diff --git a/test/monitor-bluetooth b/test/monitor-bluetooth index a3977e206..99f3c857c 100755 --- a/test/monitor-bluetooth +++ b/test/monitor-bluetooth @@ -14,17 +14,17 @@ relevant_ifaces = [ "org.bluez.Adapter1", "org.bluez.Device1" ] def property_changed(interface, changed, invalidated, path): iface = interface[interface.rfind(".") + 1:] - for name, value in changed.iteritems(): + for name, value in changed.items(): val = str(value) print("{%s.PropertyChanged} [%s] %s = %s" % (iface, path, name, val)) def interfaces_added(path, interfaces): - for iface, props in interfaces.iteritems(): + for iface, props in interfaces.items(): if not(iface in relevant_ifaces): continue print("{Added %s} [%s]" % (iface, path)) - for name, value in props.iteritems(): + for name, value in props.items(): print(" %s = %s" % (name, value)) def interfaces_removed(path, interfaces): diff --git a/test/test-adapter b/test/test-adapter index a216140ba..c56ba9577 100755 --- a/test/test-adapter +++ b/test/test-adapter @@ -61,7 +61,7 @@ if (args[0] == "list"): om = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") objects = om.GetManagedObjects() - for path, interfaces in objects.iteritems(): + for path, interfaces in objects.items(): if "org.bluez.Adapter1" not in interfaces: continue diff --git a/test/test-device b/test/test-device index a1e508166..c840f0565 100755 --- a/test/test-device +++ b/test/test-device @@ -49,7 +49,7 @@ if (args[0] == "list"): "org.freedesktop.DBus.ObjectManager") objects = om.GetManagedObjects() - for path, interfaces in objects.iteritems(): + for path, interfaces in objects.items(): if "org.bluez.Device1" not in interfaces: continue properties = interfaces["org.bluez.Device1"] diff --git a/test/test-discovery b/test/test-discovery index eccc7c7e3..54fc51403 100755 --- a/test/test-discovery +++ b/test/test-discovery @@ -19,7 +19,7 @@ def print_compact(address, properties): name = "" address = "" - for key, value in properties.iteritems(): + for key, value in properties.items(): if type(value) is dbus.String: value = unicode(value).encode('ascii', 'replace') if (key == "Name"): @@ -153,7 +153,7 @@ if __name__ == '__main__': om = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") objects = om.GetManagedObjects() - for path, interfaces in objects.iteritems(): + for path, interfaces in objects.items(): if "org.bluez.Device1" in interfaces: devices[path] = interfaces["org.bluez.Device1"] diff --git a/test/test-health b/test/test-health index d6b437ed8..3e16c415d 100755 --- a/test/test-health +++ b/test/test-health @@ -147,7 +147,7 @@ manager = dbus.Interface(bus.get_object(BUS_NAME, "/"), objects = manager.GetManagedObjects() adapters = [] -for path, ifaces in objects.iteritems(): +for path, ifaces in objects.items(): if ifaces.has_key(ADAPTER_INTERFACE): adapters.append(path) @@ -172,7 +172,7 @@ while select == None: adapter = dbus.Interface(bus.get_object(BUS_NAME, select), ADAPTER_INTERFACE) devices = [] -for path, interfaces in objects.iteritems(): +for path, interfaces in objects.items(): if "org.bluez.Device1" not in interfaces: continue properties = interfaces["org.bluez.Device1"] diff --git a/test/test-health-sink b/test/test-health-sink index 57665d2ba..13b9a6b04 100755 --- a/test/test-health-sink +++ b/test/test-health-sink @@ -41,7 +41,7 @@ manager = dbus.Interface(bus.get_object(BUS_NAME, "/"), objects = manager.GetManagedObjects() adapters = [] -for path, ifaces in objects.iteritems(): +for path, ifaces in objects.items(): if ifaces.has_key(ADAPTER_INTERFACE): adapters.append(path) @@ -67,7 +67,7 @@ adapter = dbus.Interface(bus.get_object(BUS_NAME, select), ADAPTER_INTERFACE) devices = [] -for path, interfaces in objects.iteritems(): +for path, interfaces in objects.items(): if "org.bluez.Device1" not in interfaces: continue properties = interfaces["org.bluez.Device1"] -- 2.34.1