on xenial help sign in
Fixed style and static python errors.
commit6ce91e0bf7d575c86fd0568830e6dbfada979198 authorLeo Arias <leo.arias@canonical.com> dateThu 3 Jul 2014, 14:45 (12 years ago) parentc8013e286235e0
10 files changed+136−71
.bazaar/plugins/makecheck_unity_phablet.py+16−8 tests/autopilot/unity8/process_helpers.py+4−3 tests/autopilot/unity8/shell/tests/__init__.py+1−2 tests/autopilot/unity8/shell/tests/disabled_test_hud.py+44−13 tests/autopilot/unity8/shell/tests/test_emulators.py−2 tests/autopilot/unity8/shell/tests/test_lock_screen.py+4−5 tests/autopilot/unity8/shell/tests/test_notifications.py+15−10 tests/autopilot/unity8/shell/tests/test_system_integration.py+10−5 tests/autopilot/unity8/shell/tests/test_upstart.py+20−11 tests/whitespace/check_whitespace.py+22−12
.bazaar/plugins/makecheck_unity_phablet.py+16−8
@@ -1,5 +1,5 @@
11#!/usr/bin/python
2−# Copyright 2013 Canonical Ltd.
2+# Copyright 2013, 2014 Canonical Ltd.
33#
44# This program is free software; you can redistribute it and/or modify
55# it under the terms of the GNU Lesser General Public License as published by
@@ -13,11 +13,15 @@
1313# You should have received a copy of the GNU Lesser General Public License
1414# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
16−import os, subprocess
17−from bzrlib import branch, errors
18−from bzrlib.urlutils import dirname, local_path_from_url
16+import os
17+import subprocess
18+from bzrlib import branch
19+from bzrlib.urlutils import local_path_from_url
1920
20−def execute_makecheck(local_branch, master_branch, old_revision_number, old_revision_id, future_revision_number, future_revision_id, tree_delta, future_tree):
21+
22+def execute_makecheck(
23+ local_branch, master_branch, old_revision_number, old_revision_id,
24+ future_revision_number, future_revision_id, tree_delta, future_tree):
2125 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
2226 return
2327
@@ -27,7 +31,9 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
2731 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
2832 if (subprocess.call("make -C builddir test", shell=True) != 0):
2933
30− print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
34+ print("\n\n*** Warning ***\n\n"
35+ "Basic tests failed. This commit will not pass continuous "
36+ "integration.")
3137
3238 branch = local_branch or master_branch
3339 revision = branch.repository.get_revision(future_revision_id)
@@ -36,8 +42,10 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
3642 msg_file.close()
3743
3844 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
39− print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
45+ print("You can uncommit this revision, fix the tests and reuse your "
46+ "message running:\n\nbzr commit -F message.txt\n\n")
4047 elif os.path.isfile("message.txt"):
4148 os.remove("message.txt")
4249
43−branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
50+branch.Branch.hooks.install_named_hook(
51+ 'pre_commit', execute_makecheck, 'make check pre-commit')
tests/autopilot/unity8/process_helpers.py+4−3
@@ -75,7 +75,7 @@ def unlock_unity(unity_proxy_obj=None):
7575 main_window_emulator.QQuickView)
7676
7777 greeter = main_window.get_greeter()
78− if greeter.created == False:
78+ if greeter.created is False:
7979 raise RuntimeWarning("Greeter appears to be already unlocked.")
8080
8181 # Because of potential input jerkiness under heavy load,
@@ -98,7 +98,8 @@ def unlock_unity(unity_proxy_obj=None):
9898
9999def lock_unity(unity_proxy_obj=None):
100100 """Helper function that attempts to lock the unity greeter."""
101− import evdev, time
101+ import evdev
102+ import time
102103 uinput = evdev.UInput(name='unity8-autopilot-power-button',
103104 devnode='/dev/autopilot-uinput')
104105 # One press and release to turn screen off (locking unity)
@@ -172,7 +173,7 @@ def _get_unity_status():
172173
173174def _get_unity_pid():
174175 status = _get_unity_status()
175− if not "start/" in status:
176+ if "start/" not in status:
176177 raise CannotAccessUnity("Unity is not in the running state.")
177178 return int(status.split()[-1])
178179
tests/autopilot/unity8/shell/tests/__init__.py+1−2
@@ -142,12 +142,11 @@ class UnityTestCase(AutopilotTestCase):
142142 self._data_dirs_mock_enabled = True
143143 self._environment = {}
144144
145− #### FIXME: This is a work around re: lp:1238417 ####
145+ # FIXME: This is a work around re: lp:1238417
146146 if model() != "Desktop":
147147 from autopilot.input import _uinput
148148 _uinput._touch_device = _uinput.create_touch_device()
149149 self.addCleanup(_uinput._touch_device.close)
150− ####
151150
152151 self.touch = Touch.create()
153152 self._setup_display_details()
tests/autopilot/unity8/shell/tests/disabled_test_hud.py+44−13
@@ -20,12 +20,13 @@
2020from __future__ import absolute_import
2121
2222from unity8.process_helpers import unlock_unity
23−from unity8.shell import with_lightdm_mock, DragMixin
23+from unity8.shell import DragMixin
2424from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2525
2626from testtools.matchers import Equals
2727from autopilot.matchers import Eventually
2828
29+
2930class TestHud(UnityTestCase, DragMixin):
3031
3132 """Tests the Shell HUD."""
@@ -33,10 +34,14 @@ class TestHud(UnityTestCase, DragMixin):
3334 scenarios = _get_device_emulation_scenarios()
3435
3536 def test_show_hud_button_appears(self):
36− """Swiping up while an app is active must show the 'show hud' button, following some behaviours.
37+ """Swiping up while an app is active must show the 'show hud' button.
38+
39+ It should follow some behaviours.
3740 The button must disappear not opening the HUD when releasing the
38− mouse again somewhere on the screen except on the button itself following a timeout.
39− The button must disappear when touching somewhere on the screen except the button itself.
41+ mouse again somewhere on the screen except on the button itself
42+ following a timeout.
43+ The button must disappear when touching somewhere on the screen
44+ except the button itself.
4045
4146 """
4247 unity_proxy = self.launch_unity()
@@ -55,29 +60,47 @@ class TestHud(UnityTestCase, DragMixin):
5560
5661 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
5762 self.addCleanup(self._maybe_release_finger)
58− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
63+ self._drag(
64+ swipe_coords.start_x,
65+ swipe_coords.start_y,
66+ swipe_coords.start_x,
67+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
5968 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5)))
60− self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin)))
61− self._drag(swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5, swipe_coords.end_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - int(edge_drag_area.commitDistance) - 5)
69+ self.assertThat(
70+ hud_show_button.bottomMargin,
71+ Eventually(Equals(initialBottomMargin)))
72+ self._drag(
73+ swipe_coords.start_x,
74+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5,
75+ swipe_coords.end_x,
76+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) -
77+ int(edge_drag_area.commitDistance) - 5)
6278 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
6379 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0)))
64− self.touch.release();
80+ self.touch.release()
6581 self.assertThat(hud.shown, Equals(False))
6682 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
6783
6884 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
69− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
85+ self._drag(
86+ swipe_coords.start_x,
87+ swipe_coords.start_y,
88+ swipe_coords.start_x,
89+ swipe_coords.end_y - int(hud_show_button.height))
7090 self.assertThat(hud.shown, Equals(False))
7191 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
7292 self.touch.release()
7393 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
74− self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height))
94+ self.touch.tap(
95+ swipe_coords.end_x,
96+ swipe_coords.end_y - int(hud_show_button.height))
7597 self.assertThat(hud.shown, Equals(False))
7698 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
7799
78100 def test_show_hud_appears(self):
79101 """Releasing the touch on the 'show hud' button must display the hud.
80− Test that the hud button stays on screen and tapping it opens the hud.
102+ Test that the hud button stays on screen and tapping it opens the
103+ hud.
81104
82105 """
83106 unity_proxy = self.launch_unity()
@@ -94,7 +117,11 @@ class TestHud(UnityTestCase, DragMixin):
94117
95118 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
96119 self.addCleanup(self._maybe_release_finger)
97− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y)
120+ self._drag(
121+ swipe_coords.start_x,
122+ swipe_coords.start_y,
123+ swipe_coords.start_x,
124+ swipe_coords.end_y)
98125 self.assertThat(hud.shown, Eventually(Equals(False)))
99126 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
100127 self.touch.release()
@@ -105,7 +132,11 @@ class TestHud(UnityTestCase, DragMixin):
105132 self.assertThat(hud.shown, Eventually(Equals(False)))
106133
107134 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
108− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
135+ self._drag(
136+ swipe_coords.start_x,
137+ swipe_coords.start_y,
138+ swipe_coords.start_x,
139+ swipe_coords.end_y - int(hud_show_button.height))
109140 self.assertThat(hud.shown, Equals(False))
110141 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
111142 self.touch.release()
tests/autopilot/unity8/shell/tests/test_emulators.py−2
@@ -32,8 +32,6 @@ try:
3232except ImportError:
3333 import mock
3434
35−from testtools.matchers import Contains, HasLength
36−
3735from unity8 import process_helpers
3836from unity8.shell import emulators, fixture_setup, tests
3937from unity8.shell.emulators import dash as dash_emulators
tests/autopilot/unity8/shell/tests/test_lock_screen.py+4−5
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -25,9 +25,7 @@ from unity8.shell import with_lightdm_mock
2525from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2626
2727from autopilot.matchers import Eventually
28−from autopilot.platform import model
2928import sys
30−from testtools import skipUnless
3129from testtools.matchers import Equals
3230import logging
3331
@@ -133,7 +131,7 @@ class TestLockscreen(UnityTestCase):
133131 if not isinstance(code, basestring):
134132 raise TypeError(
135133 "'code' parameter must be a string, not %r."
136− % type(passphrase)
134+ % type(code)
137135 )
138136 for num in code:
139137 if not num.isdigit():
@@ -190,7 +188,8 @@ class TestLockscreen(UnityTestCase):
190188 current_text = prompt.text
191189 self.keyboard.type(character)
192190 try:
193− self.assertThat(prompt.text, Eventually(Equals(current_text + character)))
191+ self.assertThat(
192+ prompt.text, Eventually(Equals(current_text + character)))
194193 except AssertionError:
195194 if retries > 0:
196195 self._type_character(character, prompt, retries-1)
tests/autopilot/unity8/shell/tests/test_notifications.py+15−10
@@ -211,8 +211,8 @@ class InteractiveNotificationBase(NotificationsBase):
211211 self.touch.tap_object(notification.select_single(objectName="button4"))
212212 self.assert_notification_action_id_was_called("action_decline_4")
213213
214− def test_modal_sd_without_greeter (self):
215− """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
214+ def test_modal_sd_without_greeter(self):
215+ """Snap-decision should block input to shell without greeter."""
216216 unity_proxy = self.launch_unity()
217217 unlock_unity(unity_proxy)
218218
@@ -238,7 +238,8 @@ class InteractiveNotificationBase(NotificationsBase):
238238 hints
239239 )
240240
241− # verify that we cannot reveal the launcher (no longer interact with the shell)
241+ # verify that we cannot reveal the launcher (no longer interact with
242+ # the shell)
242243 time.sleep(1)
243244 self.main_window.show_dash_swiping()
244245 launcher = self.main_window.get_launcher()
@@ -249,13 +250,14 @@ class InteractiveNotificationBase(NotificationsBase):
249250 get_notification = lambda: notify_list.wait_select_single(
250251 'Notification', objectName='notification1')
251252 notification = get_notification()
252− self._assert_notification(notification, summary, body, True, False, 1.0)
253+ self._assert_notification(
254+ notification, summary, body, True, False, 1.0)
253255 self.touch.tap_object(notification.select_single(objectName="button0"))
254256 self.assert_notification_action_id_was_called("action_accept")
255257
256− def test_modal_sd_with_greeter (self):
257− """A snap-decision on a phone should not block input to the greeter beneath it."""
258− unity_proxy = self.launch_unity()
258+ def test_modal_sd_with_greeter(self):
259+ """A snap-decision should not block input to the greeter beneath it."""
260+ self.launch_unity()
259261
260262 summary = "Incoming file"
261263 body = "Frank would like to send you the file: essay.pdf"
@@ -290,7 +292,8 @@ class InteractiveNotificationBase(NotificationsBase):
290292 get_notification = lambda: notify_list.wait_select_single(
291293 'Notification', objectName='notification1')
292294 notification = get_notification()
293− self._assert_notification(notification, summary, body, True, False, 1.0)
295+ self._assert_notification(
296+ notification, summary, body, True, False, 1.0)
294297 self.touch.tap_object(notification.select_single(objectName="button0"))
295298 self.assert_notification_action_id_was_called("action_accept")
296299
@@ -663,7 +666,8 @@ class EphemeralNotificationsTests(NotificationsBase):
663666 icon_path = self._get_icon_path('avatars/amanda.png')
664667 notification.update(summary, body, icon_path)
665668 notification.show()
666− self._assert_notification(get_notification(), summary, body, True, False, 1.0)
669+ self._assert_notification(
670+ get_notification(), summary, body, True, False, 1.0)
667671
668672 def test_update_notification_layout_change(self):
669673 """Notification must allow updating its contents and layout while
@@ -710,7 +714,8 @@ class EphemeralNotificationsTests(NotificationsBase):
710714 notification.show()
711715
712716 self.assertThat(get_notification, Eventually(NotEquals(None)))
713− self._assert_notification(get_notification(), summary, body, False, False, 1.0)
717+ self._assert_notification(
718+ get_notification(), summary, body, False, False, 1.0)
714719
715720 def test_append_hint(self):
716721 """Notification has to accumulate body-text using append-hint."""
tests/autopilot/unity8/shell/tests/test_system_integration.py+10−5
@@ -23,19 +23,24 @@ import subprocess
2323import unittest
2424
2525from autopilot import platform
26−from unity8.shell.emulators import UnityEmulatorBase
2726from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2827
29−from testtools.matchers._basic import Equals
3028
3129class SystemIntegrationTests(UnityTestCase):
3230
3331 scenarios = _get_device_emulation_scenarios()
3432
35− @unittest.skipIf(platform.model() == "Desktop", "Test is broken on otto, see bug 1281634.")
33+ @unittest.skipIf(
34+ platform.model() == "Desktop",
35+ "Test is broken on otto, see bug 1281634.")
3636 def test_networkmanager_integration(self):
3737 self.launch_unity()
3838
3939 # invoke policykit to check permissions
40− pid = subprocess.check_output(["pidof", "-s", "unity8"], universal_newlines=True)
41− subprocess.check_call("pkcheck --action-id org.freedesktop.NetworkManager.enable-disable-network --process " + pid, shell=True)
40+ pid = subprocess.check_output(
41+ ["pidof", "-s", "unity8"], universal_newlines=True)
42+ subprocess.check_call(
43+ "pkcheck --action-id "
44+ "org.freedesktop.NetworkManager.enable-disable-network "
45+ "--process " + pid,
46+ shell=True)
tests/autopilot/unity8/shell/tests/test_upstart.py+20−11
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
4+# Copyright (C) 2013, 2014 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -42,19 +42,24 @@ import sys
4242if sys.version_info < (3,):
4343 range = xrange
4444
45+
4546class UpstartIntegrationTests(UnityTestCase):
4647
4748 scenarios = _get_device_emulation_scenarios()
4849
4950 def _get_status(self):
50− pid, status = os.waitpid(self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
51− logger.debug("Got status: {0}; stopped: {1}; continued: {2}"\
52− .format(status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
51+ pid, status = os.waitpid(
52+ self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
53+ logger.debug(
54+ "Got status: {0}; stopped: {1}; continued: {2}".format(
55+ status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
5356 return status
5457
5558 def _launch_unity(self):
5659 self.patch_environment("QT_LOAD_TESTABILITY", "1")
57− self.process = subprocess.Popen([get_binary_path()] + self.unity_geometry_args)
60+ self.process = subprocess.Popen(
61+ [get_binary_path()] + self.unity_geometry_args)
62+
5863 def ensure_stopped():
5964 self.process.terminate()
6065 for i in range(10):
@@ -76,10 +81,10 @@ class UpstartIntegrationTests(UnityTestCase):
7681 self.addCleanup(ensure_stopped)
7782
7883 def _set_proxy(self):
79− super(UpstartIntegrationTests, self)._set_proxy(get_proxy_object_for_existing_process(
80− pid=self.process.pid,
81− emulator_base=UnityEmulatorBase,
82− ))
84+ super(UpstartIntegrationTests, self)._set_proxy(
85+ get_proxy_object_for_existing_process(
86+ pid=self.process.pid,
87+ emulator_base=UnityEmulatorBase,))
8388
8489 def test_no_sigstop(self):
8590 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
@@ -93,10 +98,14 @@ class UpstartIntegrationTests(UnityTestCase):
9398 def test_expect_sigstop(self):
9499 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
95100 self._launch_unity()
96− self.assertThat(lambda: os.WIFSTOPPED(self._get_status()), Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
101+ self.assertThat(
102+ lambda: os.WIFSTOPPED(self._get_status()),
103+ Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
97104
98105 self.process.send_signal(signal.SIGCONT)
99− self.assertThat(lambda: os.WIFCONTINUED(self._get_status()), Eventually(Equals(True)), "Unity8 should have resumed")
106+ self.assertThat(
107+ lambda: os.WIFCONTINUED(self._get_status()),
108+ Eventually(Equals(True)), "Unity8 should have resumed")
100109
101110 logger.debug("Unity started, waiting for it to be ready.")
102111 self._set_proxy()
tests/whitespace/check_whitespace.py+22−12
@@ -1,7 +1,7 @@
11#! /usr/bin/env python3
22
33#
4−# Copyright (C) 2013 Canonical Ltd
4+# Copyright (C) 2013, 2014 Canonical Ltd
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License version 3 as
@@ -19,8 +19,8 @@
1919#
2020
2121#
22−# Little helper program to test that source files do not contain trailing whitespace
23−# or tab indentation.
22+# Little helper program to test that source files do not contain trailing
23+# whitespace or tab indentation.
2424#
2525# Usage: check_whitespace.py directory [ignore_prefix]
2626#
@@ -31,18 +31,20 @@
3131# See the file_pat definition below for a list of files that are checked.
3232#
3333
34+from __future__ import print_function
35+
3436import argparse
3537import os
3638import re
3739import sys
3840
39−# Print msg on stderr, preceded by program name and followed by newline
4041
42+# Print msg on stderr, preceded by program name and followed by newline
4143def error(msg):
4244 print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr)
4345
44−# Function to raise errors encountered by os.walk
4546
47+# Function to raise errors encountered by os.walk
4648def raise_error(e):
4749 raise e
4850
@@ -52,6 +54,7 @@ def raise_error(e):
5254whitespace_pat = re.compile(r'.*[ \t]$')
5355tab_indent_pat = re.compile(r'^ *\t')
5456
57+
5558def scan_for_bad_whitespace(file_path):
5659 global tab_indent_pat, whitespace_pat
5760 errors = []
@@ -69,7 +72,9 @@ def scan_for_bad_whitespace(file_path):
6972 plural = 's'
7073 else:
7174 plural = ''
72− print("%s: bad whitespace in line%s %s" % (file_path, plural, ", ".join((str(i) for i in errors))))
75+ print(
76+ "%s: bad whitespace in line%s %s" % (
77+ file_path, plural, ", ".join((str(i) for i in errors))))
7378 elif errors:
7479 print("%s: bad whitespace in multiple lines" % file_path)
7580 if newlines_at_end:
@@ -78,15 +83,20 @@ def scan_for_bad_whitespace(file_path):
7883
7984# Parse args
8085
81−parser = argparse.ArgumentParser(description = 'Test that source files do not contain trailing whitespace.')
82−parser.add_argument('dir', nargs = 1, help = 'The directory to (recursively) search for source files')
83−parser.add_argument('ignore_prefix', nargs = '?', default=None,
84− help = 'Ignore source files with a path that starts with the given prefix.')
86+parser = argparse.ArgumentParser(
87+ description='Test that source files do not contain trailing whitespace.')
88+parser.add_argument(
89+ 'dir', nargs=1,
90+ help='The directory to (recursively) search for source files')
91+parser.add_argument(
92+ 'ignore_prefix', nargs='?', default=None,
93+ help='Ignore source files with a path that starts with the given prefix.')
8594args = parser.parse_args()
8695
8796# Files we want to check for trailing whitespace.
8897
89−file_pat = r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)'
98+file_pat = (
99+ r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)')
90100pat = re.compile(file_pat)
91101
92102# Find all the files with matching file extension in the specified
@@ -97,7 +107,7 @@ ignore = args.ignore_prefix and os.path.abspath(args.ignore_prefix) or None
97107
98108found_whitespace = False
99109try:
100− for root, dirs, files in os.walk(directory, onerror = raise_error):
110+ for root, dirs, files in os.walk(directory, onerror=raise_error):
101111 for file in files:
102112 path = os.path.join(root, file)
103113 if not (ignore and path.startswith(ignore)) and pat.match(file):