interfaces: change a couple of dirstate fields to `@property`
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 27 Sep 2024 12:10:25 -0400
changeset 51928 3688a984134b
parent 51927 e99c007030da
child 51929 93d872a06132
interfaces: change a couple of dirstate fields to `@property` As I was adding type hints here and to the concrete classes, PyCharm flagged the property in the core class as not being compatible with the base class's version.
mercurial/interfaces/dirstate.py
--- a/mercurial/interfaces/dirstate.py	Fri Sep 27 12:05:48 2024 -0400
+++ b/mercurial/interfaces/dirstate.py	Fri Sep 27 12:10:25 2024 -0400
@@ -40,8 +40,9 @@
     # public or removed from the interface.
 
     # TODO: decorate with `@rootcache(b'.hgignore')` like dirstate class?
-    _ignore: matchmod.basematcher
-    """Matcher for ignored files."""
+    @property
+    def _ignore(self) -> matchmod.basematcher:
+        """Matcher for ignored files."""
 
     @property
     def is_changing_any(self) -> bool:
@@ -63,17 +64,15 @@
 
     # TODO: decorate with `@util.propertycache` like dirstate class?
     #  (can't because circular import)
-    # TODO: The doc looks wrong- the core class has this as a @property, not a
-    #  callable.
-    _checklink: Callable
-    """Callable for checking symlinks."""
+    @property
+    def _checklink(self) -> bool:
+        """Callable for checking symlinks."""  # TODO: this comment looks stale
 
     # TODO: decorate with `@util.propertycache` like dirstate class?
     #  (can't because circular import)
-    # TODO: The doc looks wrong- the core class has this as a @property, not a
-    #  callable.
-    _checkexec: Callable
-    """Callable for checking exec bits."""
+    @property
+    def _checkexec(self) -> bool:
+        """Callable for checking exec bits."""  # TODO: this comment looks stale
 
     @contextlib.contextmanager
     def changing_parents(self, repo):