mercurial/pure/bdiff.py
changeset 51930 09f3a6790e56
parent 51859 f4733654f144
--- a/mercurial/pure/bdiff.py	Sat Sep 28 19:12:18 2024 -0400
+++ b/mercurial/pure/bdiff.py	Sun Sep 29 02:03:20 2024 -0400
@@ -10,12 +10,18 @@
 import difflib
 import re
 import struct
+import typing
 
 from typing import (
     List,
+    Optional,
     Tuple,
 )
 
+from ..interfaces import (
+    modules as intmod,
+)
+
 
 def splitnewlines(text: bytes) -> List[bytes]:
     '''like str.splitlines, but only split on newlines.'''
@@ -107,3 +113,11 @@
         text = re.sub(b'[ \t\r]+', b' ', text)
         text = text.replace(b' \n', b'\n')
     return text
+
+
+# In order to adhere to the module protocol, these functions must be visible to
+# the type checker, though they aren't actually implemented by this
+# implementation of the module protocol.  Callers are responsible for
+# checking that the implementation is available before using them.
+if typing.TYPE_CHECKING:
+    xdiffblocks: Optional[intmod.BDiffBlocksFnc] = None