diff mercurial/scmutil.py @ 52670:4cb75772818d

pyupgrade: drop the quoting around type annotations This is the `typing_pep563` fixer in `pyupgrade`. Quoting to delay evaluation hasn't been necessary since adding `from __future__ import annotations` in 1c5810ce737e.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 00:30:55 -0500
parents e627cc25b6f3
children f066fc0bdc7a
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sun Jan 05 22:26:16 2025 -0500
+++ b/mercurial/scmutil.py	Mon Jan 06 00:30:55 2025 -0500
@@ -146,7 +146,7 @@
         yield subpath, ctx2.nullsub(subpath, ctx1)
 
 
-def nochangesfound(ui: "uimod.ui", repo, excluded=None) -> None:
+def nochangesfound(ui: uimod.ui, repo, excluded=None) -> None:
     """Report no changes for push/pull, excluded is None or a list of
     nodes excluded from the push/pull.
     """
@@ -166,7 +166,7 @@
         ui.status(_(b"no changes found\n"))
 
 
-def callcatch(ui: "uimod.ui", func: Callable[[], int]) -> int:
+def callcatch(ui: uimod.ui, func: Callable[[], int]) -> int:
     """call func() with global exception handling
 
     return func() if no exception happens. otherwise do some error handling
@@ -323,7 +323,7 @@
         )
 
 
-def checkportable(ui: "uimod.ui", f: bytes) -> None:
+def checkportable(ui: uimod.ui, f: bytes) -> None:
     '''Check if filename f is portable and warn or abort depending on config'''
     checkfilename(f)
     abort, warn = checkportabilityalert(ui)
@@ -336,7 +336,7 @@
             ui.warn(_(b"warning: %s\n") % msg)
 
 
-def checkportabilityalert(ui: "uimod.ui") -> Tuple[bool, bool]:
+def checkportabilityalert(ui: uimod.ui) -> Tuple[bool, bool]:
     """check if the user's config requests nothing, a warning, or abort for
     non-portable filenames"""
     val = ui.config(b'ui', b'portablefilenames')
@@ -352,7 +352,7 @@
 
 
 class casecollisionauditor:
-    def __init__(self, ui: "uimod.ui", abort: bool, dirstate) -> None:
+    def __init__(self, ui: uimod.ui, abort: bool, dirstate) -> None:
         self._ui = ui
         self._abort = abort
         allfiles = b'\0'.join(dirstate)
@@ -544,7 +544,7 @@
     return formatrevnode(repo.ui, intrev(ctx), binnode(ctx))
 
 
-def formatrevnode(ui: "uimod.ui", rev: int, node: bytes) -> bytes:
+def formatrevnode(ui: uimod.ui, rev: int, node: bytes) -> bytes:
     """Format given revision and node depending on the current verbosity"""
     if ui.debugflag:
         hexfunc = hex
@@ -1080,7 +1080,7 @@
         return files[0]
 
 
-def getorigvfs(ui: "uimod.ui", repo):
+def getorigvfs(ui: uimod.ui, repo):
     """return a vfs suitable to save 'orig' file
 
     return None if no special directory is configured"""
@@ -1090,7 +1090,7 @@
     return vfs.vfs(repo.wvfs.join(origbackuppath))
 
 
-def backuppath(ui: "uimod.ui", repo, filepath: bytes) -> bytes:
+def backuppath(ui: uimod.ui, repo, filepath: bytes) -> bytes:
     """customize where working copy backup files (.orig files) are created
 
     Fetch user defined path from config file: [ui] origbackuppath = <path>
@@ -1580,7 +1580,7 @@
 
 
 def dirstatecopy(
-    ui: "uimod.ui",
+    ui: uimod.ui,
     repo,
     wctx,
     src,
@@ -1956,7 +1956,7 @@
 
 
 class progress:
-    ui: "uimod.ui"
+    ui: uimod.ui
     pos: Optional[int]  # None once complete
     topic: bytes
     unit: bytes
@@ -1965,7 +1965,7 @@
 
     def __init__(
         self,
-        ui: "uimod.ui",
+        ui: uimod.ui,
         updatebar,
         topic: bytes,
         unit: bytes = b"",
@@ -2024,7 +2024,7 @@
             self.ui.debug(b'%s:%s %d%s\n' % (self.topic, item, self.pos, unit))
 
 
-def gdinitconfig(ui: "uimod.ui"):
+def gdinitconfig(ui: uimod.ui):
     """helper function to know if a repo should be created as general delta"""
     # experimental config: format.generaldelta
     return ui.configbool(b'format', b'generaldelta') or ui.configbool(
@@ -2032,7 +2032,7 @@
     )
 
 
-def gddeltaconfig(ui: "uimod.ui"):
+def gddeltaconfig(ui: uimod.ui):
     """helper function to know if incoming deltas should be optimized
 
     The `format.generaldelta` config is an old form of the config that also
@@ -2485,7 +2485,7 @@
     )
 
 
-def ismember(ui: "uimod.ui", username: bytes, userlist: List[bytes]) -> bool:
+def ismember(ui: uimod.ui, username: bytes, userlist: List[bytes]) -> bool:
     """Check if username is a member of userlist.
 
     If userlist has a single '*' member, all users are considered members.
@@ -2511,7 +2511,7 @@
 
 
 def get_resource_profile(
-    ui: "uimod.ui", dimension: Optional[bytes] = None
+    ui: uimod.ui, dimension: Optional[bytes] = None
 ) -> int:
     """return the resource profile for a dimension