changeset 49910:464fe8b8f474

typing: add type hints to the platform `cachestat` classes
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 16 Dec 2022 18:14:54 -0500
parents 1d1b244a91b6
children ae93ada06454
files mercurial/posix.py mercurial/windows.py
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Fri Dec 16 14:24:02 2022 -0500
+++ b/mercurial/posix.py	Fri Dec 16 18:14:54 2022 -0500
@@ -20,6 +20,7 @@
 import unicodedata
 
 from typing import (
+    Any,
     Iterable,
     Iterator,
     List,
@@ -672,15 +673,15 @@
 
 
 class cachestat:
-    def __init__(self, path):
+    def __init__(self, path: bytes) -> None:
         self.stat = os.stat(path)
 
-    def cacheable(self):
+    def cacheable(self) -> bool:
         return bool(self.stat.st_ino)
 
     __hash__ = object.__hash__
 
-    def __eq__(self, other):
+    def __eq__(self, other: Any) -> bool:
         try:
             # Only dev, ino, size, mtime and atime are likely to change. Out
             # of these, we shouldn't compare atime but should compare the
@@ -701,7 +702,7 @@
         except AttributeError:
             return False
 
-    def __ne__(self, other):
+    def __ne__(self, other: Any) -> bool:
         return not self == other
 
 
--- a/mercurial/windows.py	Fri Dec 16 14:24:02 2022 -0500
+++ b/mercurial/windows.py	Fri Dec 16 18:14:54 2022 -0500
@@ -664,10 +664,10 @@
 
 
 class cachestat:
-    def __init__(self, path):
+    def __init__(self, path: bytes) -> None:
         pass
 
-    def cacheable(self):
+    def cacheable(self) -> bool:
         return False