From 15b8f1a84f2120977458cb46b2afcaa5185f2829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Manuel=20T=C3=A9llez=20G=C3=B3mez?= Date: Mon, 27 Feb 2023 16:24:46 -0800 Subject: [PATCH] Fixes syntax warnings on using "is" instead of "==". Fixes syntax warnings on using "is" instead of "==" for comparing literals. --- uiautomator/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uiautomator/__init__.py b/uiautomator/__init__.py index 533793d..09675ed 100644 --- a/uiautomator/__init__.py +++ b/uiautomator/__init__.py @@ -295,7 +295,7 @@ def device_serial(self): if not self.default_serial: devices = self.devices() if devices: - if len(devices) is 1: + if len(devices) == 1: self.default_serial = list(devices.keys())[0] else: raise EnvironmentError("Multiple devices attached but default android serial not set.") @@ -639,7 +639,7 @@ def screenshot(self, filename, scale=1.0, quality=100): p = self.server.adb.cmd("pull", device_file, filename) p.wait() self.server.adb.cmd("shell", "rm", device_file).wait() - return filename if p.returncode is 0 else None + return filename if p.returncode == 0 else None def freeze_rotation(self, freeze=True): '''freeze or unfreeze the device rotation in current status.'''