From d8e7897ff7cdf68ef79835df5a73c44dcccf7808 Mon Sep 17 00:00:00 2001 From: Thomas Polasek Date: Fri, 6 Dec 2024 10:37:02 -0800 Subject: [PATCH] Convert FBCODE to use the Ruff Formatter Summary: Converts the directory specified to use the Ruff formatter. This is the last big diff to convert all of Fbcode to Ruff. pomsky_fix_bugs drop-conflicts bypass-github-export-checks allow-large-files Reviewed By: amyreese Differential Revision: D66886610 fbshipit-source-id: 8276a7f6164efec189ca0b87e535543ed5bc3615 --- watchman/integration/eden/test_eden_glob_upper_bound.py | 6 ++++-- watchman/integration/eden/test_eden_unmount.py | 1 - watchman/integration/lib/path_utils.py | 1 - watchman/integration/test_dir_move.py | 1 - watchman/integration/test_path_generator.py | 8 ++++++-- watchman/python/tests/tests.py | 2 +- watchman/test/async/AsyncWatchmanTestCase.py | 1 - 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/watchman/integration/eden/test_eden_glob_upper_bound.py b/watchman/integration/eden/test_eden_glob_upper_bound.py index 0e7c7710b476..7c78a4c515c8 100644 --- a/watchman/integration/eden/test_eden_glob_upper_bound.py +++ b/watchman/integration/eden/test_eden_glob_upper_bound.py @@ -137,8 +137,10 @@ def test_eden_since_upper_bound_case_insensitive(self) -> None: ["mixedCASE/file1", "MIXEDcase/file2"], ) self.assertGlobUpperBound( - # We can't bound this query with a glob on a case-sensitive FS. - (None if self.isCaseSensitiveMount(root) else {"mixedcase/**"}) + ( + # We can't bound this query with a glob on a case-sensitive FS. + None if self.isCaseSensitiveMount(root) else {"mixedcase/**"} + ) ) def test_eden_since_upper_bound_includedotfiles(self) -> None: diff --git a/watchman/integration/eden/test_eden_unmount.py b/watchman/integration/eden/test_eden_unmount.py index d440412b3054..8f43acdfbc70 100644 --- a/watchman/integration/eden/test_eden_unmount.py +++ b/watchman/integration/eden/test_eden_unmount.py @@ -19,7 +19,6 @@ def populate(repo): class TestEdenUnmount(WatchmanEdenTestCase.WatchmanEdenTestCase): def test_eden_unmount(self) -> None: - root = self.makeEdenMount(populate) self.watchmanCommand("watch", root) diff --git a/watchman/integration/lib/path_utils.py b/watchman/integration/lib/path_utils.py index 9cff6576929d..bfca3a7af238 100644 --- a/watchman/integration/lib/path_utils.py +++ b/watchman/integration/lib/path_utils.py @@ -15,7 +15,6 @@ if os.name == "nt": def open_file_win(path): - create_file = ctypes.windll.kernel32.CreateFileW c_path = ctypes.create_unicode_buffer(path) diff --git a/watchman/integration/test_dir_move.py b/watchman/integration/test_dir_move.py index 07058c7ca44d..bf620d465ea5 100644 --- a/watchman/integration/test_dir_move.py +++ b/watchman/integration/test_dir_move.py @@ -17,7 +17,6 @@ @WatchmanTestCase.expand_matrix class TestDirMove(WatchmanTestCase.WatchmanTestCase): - # testing this is flaky at best on windows due to latency # and exclusivity of file handles, so skip it. def checkOSApplicability(self) -> None: diff --git a/watchman/integration/test_path_generator.py b/watchman/integration/test_path_generator.py index e5cbd05326ef..6761982e3ff0 100644 --- a/watchman/integration/test_path_generator.py +++ b/watchman/integration/test_path_generator.py @@ -48,7 +48,9 @@ def test_path_generator_case(self) -> None: self.assertFileListsEqual( self.watchmanCommand( - "query", root, {"fields": ["name"], "path": ["foo"]} # not Foo! + "query", + root, + {"fields": ["name"], "path": ["foo"]}, # not Foo! )["files"], [], message="Case insensitive matching not implemented \ @@ -89,7 +91,9 @@ def test_path_generator_relative_root(self) -> None: self.assertFileListsEqual( self.watchmanCommand( - "query", root, {"fields": ["name"], "path": ["foo"]} # not Foo! + "query", + root, + {"fields": ["name"], "path": ["foo"]}, # not Foo! )["files"], [], message="Case insensitive matching not implemented \ diff --git a/watchman/python/tests/tests.py b/watchman/python/tests/tests.py index a2e991fc2a07..5b2c4410fcdf 100755 --- a/watchman/python/tests/tests.py +++ b/watchman/python/tests/tests.py @@ -38,7 +38,7 @@ ) ) -PILE_OF_POO = "\U0001F4A9" +PILE_OF_POO = "\U0001f4a9" NON_UTF8_STRING = b"\xff\xff\xff" diff --git a/watchman/test/async/AsyncWatchmanTestCase.py b/watchman/test/async/AsyncWatchmanTestCase.py index ca63a8c23376..737a2fd0d6e7 100644 --- a/watchman/test/async/AsyncWatchmanTestCase.py +++ b/watchman/test/async/AsyncWatchmanTestCase.py @@ -43,7 +43,6 @@ def touch_relative(self, base, *fname): self.touch(fname, None) def watchman_command(self, *args): - task = asyncio.wait_for(self.client.query(*args), 10) return self.loop.run_until_complete(task)