cleanup: delete redundant "r" open mode

Change-Id: I86ebb8c5a9dc3752e8a25f4b11b64c5be3a6429e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390375
Tested-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/git_refs.py b/git_refs.py
index 8e8d603..bf7aa4a 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -105,7 +105,7 @@
     def _ReadPackedRefs(self):
         path = os.path.join(self._gitdir, "packed-refs")
         try:
-            fd = open(path, "r")
+            fd = open(path)
             mtime = os.path.getmtime(path)
         except IOError:
             return
diff --git a/project.py b/project.py
index 93d9dcb..5c9f31c 100644
--- a/project.py
+++ b/project.py
@@ -3227,7 +3227,7 @@
         # Rewrite the internal state files to use relative paths between the
         # checkouts & worktrees.
         dotgit = os.path.join(self.worktree, ".git")
-        with open(dotgit, "r") as fp:
+        with open(dotgit) as fp:
             # Figure out the checkout->worktree path.
             setting = fp.read()
             assert setting.startswith("gitdir:")
diff --git a/repo b/repo
index 36a2e0e..6b39f22 100755
--- a/repo
+++ b/repo
@@ -622,7 +622,7 @@
     if _gitc_manifest_dir is None:
         _gitc_manifest_dir = ""
         try:
-            with open(GITC_CONFIG_FILE, "r") as gitc_config:
+            with open(GITC_CONFIG_FILE) as gitc_config:
                 for line in gitc_config:
                     match = re.match("gitc_dir=(?P<gitc_manifest_dir>.*)", line)
                     if match:
diff --git a/repo_trace.py b/repo_trace.py
index d243ce6..ee224ea 100644
--- a/repo_trace.py
+++ b/repo_trace.py
@@ -142,7 +142,7 @@
 def _ClearOldTraces():
     """Clear the oldest commands if trace file is too big."""
     try:
-        with open(_TRACE_FILE, "r", errors="ignore") as f:
+        with open(_TRACE_FILE, errors="ignore") as f:
             if os.path.getsize(f.name) / (1024 * 1024) <= _MAX_SIZE:
                 return
             trace_lines = f.readlines()
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 1e87d15..2309897 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -1265,7 +1265,7 @@
         old_project_paths = []
 
         if os.path.exists(file_path):
-            with open(file_path, "r") as fd:
+            with open(file_path) as fd:
                 old_project_paths = fd.read().split("\n")
             # In reversed order, so subfolders are deleted before parent folder.
             for path in sorted(old_project_paths, reverse=True):
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py
index 600b069..478ebca 100644
--- a/tests/test_git_superproject.py
+++ b/tests/test_git_superproject.py
@@ -249,7 +249,7 @@
         os.mkdir(self._superproject._superproject_path)
         manifest_path = self._superproject._WriteManifestFile()
         self.assertIsNotNone(manifest_path)
-        with open(manifest_path, "r") as fp:
+        with open(manifest_path) as fp:
             manifest_xml_data = fp.read()
         self.assertEqual(
             sort_attributes(manifest_xml_data),
@@ -284,7 +284,7 @@
                     )
                     self.assertIsNotNone(update_result.manifest_path)
                     self.assertFalse(update_result.fatal)
-                    with open(update_result.manifest_path, "r") as fp:
+                    with open(update_result.manifest_path) as fp:
                         manifest_xml_data = fp.read()
                     self.assertEqual(
                         sort_attributes(manifest_xml_data),
@@ -371,7 +371,7 @@
                     )
                     self.assertIsNotNone(update_result.manifest_path)
                     self.assertFalse(update_result.fatal)
-                    with open(update_result.manifest_path, "r") as fp:
+                    with open(update_result.manifest_path) as fp:
                         manifest_xml_data = fp.read()
                     # Verify platform/vendor/x's project revision hasn't
                     # changed.
@@ -436,7 +436,7 @@
                     )
                     self.assertIsNotNone(update_result.manifest_path)
                     self.assertFalse(update_result.fatal)
-                    with open(update_result.manifest_path, "r") as fp:
+                    with open(update_result.manifest_path) as fp:
                         manifest_xml_data = fp.read()
                     # Verify platform/vendor/x's project revision hasn't
                     # changed.
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py
index ef4dce1..ea7a8b4 100644
--- a/tests/test_wrapper.py
+++ b/tests/test_wrapper.py
@@ -418,7 +418,7 @@
                 self.wrapper.home_dot_repo, "gnupg"
             )
             self.assertTrue(self.wrapper.SetupGnuPG(True))
-            with open(os.path.join(tempdir, "keyring-version"), "r") as fp:
+            with open(os.path.join(tempdir, "keyring-version")) as fp:
                 data = fp.read()
             self.assertEqual(
                 ".".join(str(x) for x in self.wrapper.KEYRING_VERSION),