##// END OF EJS Templates
typing: add a few trivial type hints to `mercurial/templater.py`...
Matt Harbison -
r52571:0e16efe3 default
parent child Browse files
Show More
@@ -69,6 +69,12 b' mappedgenerator'
69 import abc
69 import abc
70 import os
70 import os
71
71
72 from typing import (
73 BinaryIO,
74 Optional,
75 Tuple,
76 )
77
72 from .i18n import _
78 from .i18n import _
73 from .pycompat import (
79 from .pycompat import (
74 FileNotFoundError,
80 FileNotFoundError,
@@ -1121,7 +1127,9 b' def templatedir():'
1121 return path if os.path.isdir(path) else None
1127 return path if os.path.isdir(path) else None
1122
1128
1123
1129
1124 def open_template(name, templatepath=None):
1130 def open_template(
1131 name: bytes, templatepath: Optional[bytes] = None
1132 ) -> Tuple[bytes, BinaryIO]:
1125 """returns a file-like object for the given template, and its full path
1133 """returns a file-like object for the given template, and its full path
1126
1134
1127 If the name is a relative path and we're in a frozen binary, the template
1135 If the name is a relative path and we're in a frozen binary, the template
@@ -1156,7 +1164,9 b' def open_template(name, templatepath=Non'
1156 )
1164 )
1157
1165
1158
1166
1159 def try_open_template(name, templatepath=None):
1167 def try_open_template(
1168 name: bytes, templatepath: Optional[bytes] = None
1169 ) -> Tuple[Optional[bytes], Optional[BinaryIO]]:
1160 try:
1170 try:
1161 return open_template(name, templatepath)
1171 return open_template(name, templatepath)
1162 except (EnvironmentError, ImportError):
1172 except (EnvironmentError, ImportError):
General Comments 0
You need to be logged in to leave comments. Login now