style: use `import progress` everywhere

Align with Google style guides and `import progress` as a module
rather than import symbols out of it.

Change-Id: I3ef9109af8c6883ac0df7fa19bdb88bc6cdfd5e9
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/654818
Reviewed-by: Brian Gan <brgan@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
diff --git a/subcmds/abandon.py b/subcmds/abandon.py
index 651fc87..74fdceb 100644
--- a/subcmds/abandon.py
+++ b/subcmds/abandon.py
@@ -20,7 +20,7 @@
 from command import DEFAULT_LOCAL_JOBS
 import error
 import git_command
-from progress import Progress
+import progress
 import repo_logging
 
 
@@ -119,7 +119,7 @@
                 functools.partial(self._ExecuteOne, opt.all, nb),
                 range(len(all_projects)),
                 callback=_ProcessResults,
-                output=Progress(
+                output=progress.Progress(
                     f"Abandon {nb}", len(all_projects), quiet=opt.quiet
                 ),
                 chunksize=1,
diff --git a/subcmds/checkout.py b/subcmds/checkout.py
index 21b4b0d..c2da869 100644
--- a/subcmds/checkout.py
+++ b/subcmds/checkout.py
@@ -18,7 +18,7 @@
 from command import Command
 from command import DEFAULT_LOCAL_JOBS
 import error
-from progress import Progress
+import progress
 import repo_logging
 
 
@@ -98,7 +98,7 @@
                 functools.partial(self._ExecuteOne, nb),
                 range(len(all_projects)),
                 callback=_ProcessResults,
-                output=Progress(
+                output=progress.Progress(
                     f"Checkout {nb}", len(all_projects), quiet=opt.quiet
                 ),
             )
diff --git a/subcmds/gc.py b/subcmds/gc.py
index fcdeaf6..620e81a 100644
--- a/subcmds/gc.py
+++ b/subcmds/gc.py
@@ -18,7 +18,7 @@
 from command import Command
 import git_command
 import platform_utils
-from progress import Progress
+import progress
 from project import Project
 
 
@@ -124,7 +124,7 @@
             if ask.lower() != "y":
                 return 1
 
-        pm = Progress(
+        pm = progress.Progress(
             "Deleting",
             len(to_delete),
             delay=False,
@@ -180,7 +180,7 @@
             print(f"Would have repacked {len(repack_projects)} projects.")
             return 0
 
-        pm = Progress(
+        pm = progress.Progress(
             "Repacking (this will take a while)",
             len(repack_projects),
             delay=False,
diff --git a/subcmds/start.py b/subcmds/start.py
index 1862abe..ce2e31a 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -20,7 +20,7 @@
 import error
 import git_command
 import git_config
-from progress import Progress
+import progress
 import repo_logging
 
 
@@ -137,7 +137,7 @@
                 ),
                 range(len(all_projects)),
                 callback=_ProcessResults,
-                output=Progress(
+                output=progress.Progress(
                     f"Starting {nb}", len(all_projects), quiet=opt.quiet
                 ),
                 chunksize=1,
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 78e1b62..7e4c1d8 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -66,9 +66,7 @@
 from hooks import RepoHook
 import manifest_xml
 import platform_utils
-from progress import elapsed_str
-from progress import jobs_str
-from progress import Progress
+import progress
 from project import DeleteWorktreeError
 from project import Project
 from project import RemoteSpec
@@ -1142,8 +1140,8 @@
             return "..working.."
 
         elapsed = time.time() - earliest_time
-        jobs = jobs_str(len(items))
-        return f"{jobs} | {elapsed_str(elapsed)} {earliest_proj}"
+        jobs = progress.jobs_str(len(items))
+        return f"{jobs} | {progress.elapsed_str(elapsed)} {earliest_proj}"
 
     @classmethod
     def InitWorker(cls):
@@ -1160,7 +1158,7 @@
 
         fetched = set()
         remote_fetched = set()
-        pm = Progress(
+        pm = progress.Progress(
             "Fetching",
             len(projects),
             delay=False,
@@ -1484,7 +1482,7 @@
                     ),
                     range(len(projects)),
                     callback=_ProcessResults,
-                    output=Progress(
+                    output=progress.Progress(
                         "Checking out", len(all_projects), quiet=opt.quiet
                     ),
                     # Use chunksize=1 to avoid the chance that some workers are
@@ -1616,7 +1614,7 @@
                 cls._SetPreciousObjectsState(project, opt)
             return
 
-        pm = Progress(
+        pm = progress.Progress(
             "Garbage collecting", len(projects), delay=False, quiet=opt.quiet
         )
         pm.update(inc=0, msg="prescan")
@@ -1783,7 +1781,7 @@
         if not projects:
             return
 
-        pm = Progress(
+        pm = progress.Progress(
             "Checking for bloat", len(projects), delay=False, quiet=opt.quiet
         )
 
@@ -2810,7 +2808,7 @@
         raise e
 
     def _CreateSyncProgressThread(
-        self, pm: Progress, stop_event: _threading.Event
+        self, pm: progress.Progress, stop_event: _threading.Event
     ) -> _threading.Thread:
         """Creates and returns a daemon thread to update a Progress object.
 
@@ -3194,7 +3192,7 @@
         errors: List[Exception],
         opt: optparse.Values,
         pool: Optional[multiprocessing.Pool],
-        pm: Progress,
+        pm: progress.Progress,
         results_sets: List[_InterleavedSyncResult],
     ):
         """Callback to process results from interleaved sync workers."""
@@ -3293,7 +3291,7 @@
         err_event = multiprocessing.Event()
         finished_relpaths = set()
         project_list = list(all_projects)
-        pm = Progress(
+        pm = progress.Progress(
             "Syncing",
             len(project_list),
             delay=False,
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py
index 8e8eda2..9864203 100644
--- a/tests/test_subcmds_sync.py
+++ b/tests/test_subcmds_sync.py
@@ -36,6 +36,7 @@
 import git_command
 import git_config
 import manifest_xml
+import progress
 from project import SyncNetworkHalfResult
 from subcmds import sync
 
@@ -1502,7 +1503,7 @@
         self.assertFalse(self.cmd.git_event_log.ErrorEvent.called)
 
     @mock.patch.object(git_command, "git_require", return_value=True)
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_network_only_skips_check(
         self, mock_progress: mock.Mock, mock_git_require: mock.Mock
     ) -> None:
@@ -1516,7 +1517,7 @@
         self.cmd.ExecuteInParallel.assert_not_called()
 
     @mock.patch.object(git_command, "git_require", return_value=True)
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_projects_without_worktree_excluded(
         self, mock_progress: mock.Mock, mock_git_require: mock.Mock
     ) -> None:
@@ -1538,7 +1539,7 @@
                 self.cmd.ExecuteInParallel.assert_not_called()
 
     @mock.patch.object(git_command, "git_require")
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_bloated_project_found(self, mock_progress, mock_git_require):
         """Test that it adds project to _bloated_projects."""
         mock_git_require.return_value = True
@@ -1561,7 +1562,7 @@
         self.assertEqual(self.cmd._bloated_projects, ["project"])
 
     @mock.patch.object(git_command, "git_require")
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_stateless_prune_excluded(self, mock_progress, mock_git_require):
         """Test that projects pruned for stateless sync are excluded."""
         mock_git_require.return_value = True
@@ -1576,7 +1577,7 @@
         self.assertEqual(self.cmd._bloated_projects, [])
 
     @mock.patch.object(git_command, "git_require", return_value=True)
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_fetch_cmd_excluded(
         self, mock_progress: mock.Mock, mock_git_require: mock.Mock
     ) -> None:
@@ -1609,7 +1610,7 @@
         self.project.bare_git._project = self.project
         self.cmd.git_event_log = mock.MagicMock()
 
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_GCProjects_skip_gc(self, mock_progress):
         """Test that it skips GC if opt.auto_gc is False."""
         self.opt.auto_gc = False
@@ -1620,7 +1621,7 @@
             mock_set_state.assert_called_once_with(self.project, self.opt)
         self.assertFalse(self.project.bare_git.gc.called)
 
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_GCProjects_sequential(self, mock_progress):
         """Test sequential GC (jobs < 2)."""
         with mock.patch.object(sync.Sync, "_SetPreciousObjectsState"):
@@ -1632,7 +1633,7 @@
         for call in self.project.config.SetString.call_args_list:
             self.assertNotEqual(call.args[0], "gc.autoDetach")
 
-    @mock.patch("subcmds.sync.Progress")
+    @mock.patch.object(progress, "Progress")
     def test_GCProjects_parallel(self, mock_progress):
         """Test parallel GC (jobs >= 2)."""
         self.opt.jobs = 2