##// END OF EJS Templates
typing: add type hints to the platform `cachestat` classes
Matt Harbison -
r50710:464fe8b8 default
parent child Browse files
Show More
@@ -20,6 +20,7 b' import tempfile'
20 import unicodedata
20 import unicodedata
21
21
22 from typing import (
22 from typing import (
23 Any,
23 Iterable,
24 Iterable,
24 Iterator,
25 Iterator,
25 List,
26 List,
@@ -672,15 +673,15 b' def hidewindow() -> None:'
672
673
673
674
674 class cachestat:
675 class cachestat:
675 def __init__(self, path):
676 def __init__(self, path: bytes) -> None:
676 self.stat = os.stat(path)
677 self.stat = os.stat(path)
677
678
678 def cacheable(self):
679 def cacheable(self) -> bool:
679 return bool(self.stat.st_ino)
680 return bool(self.stat.st_ino)
680
681
681 __hash__ = object.__hash__
682 __hash__ = object.__hash__
682
683
683 def __eq__(self, other):
684 def __eq__(self, other: Any) -> bool:
684 try:
685 try:
685 # Only dev, ino, size, mtime and atime are likely to change. Out
686 # Only dev, ino, size, mtime and atime are likely to change. Out
686 # of these, we shouldn't compare atime but should compare the
687 # of these, we shouldn't compare atime but should compare the
@@ -701,7 +702,7 b' class cachestat:'
701 except AttributeError:
702 except AttributeError:
702 return False
703 return False
703
704
704 def __ne__(self, other):
705 def __ne__(self, other: Any) -> bool:
705 return not self == other
706 return not self == other
706
707
707
708
@@ -664,10 +664,10 b' def isexec(f: bytes) -> bool:'
664
664
665
665
666 class cachestat:
666 class cachestat:
667 def __init__(self, path):
667 def __init__(self, path: bytes) -> None:
668 pass
668 pass
669
669
670 def cacheable(self):
670 def cacheable(self) -> bool:
671 return False
671 return False
672
672
673
673
General Comments 0
You need to be logged in to leave comments. Login now