Show More
@@ -69,6 +69,12 b' mappedgenerator' | |||
|
69 | 69 | import abc |
|
70 | 70 | import os |
|
71 | 71 | |
|
72 | from typing import ( | |
|
73 | BinaryIO, | |
|
74 | Optional, | |
|
75 | Tuple, | |
|
76 | ) | |
|
77 | ||
|
72 | 78 | from .i18n import _ |
|
73 | 79 | from .pycompat import ( |
|
74 | 80 | FileNotFoundError, |
@@ -1121,7 +1127,9 b' def templatedir():' | |||
|
1121 | 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 | 1133 | """returns a file-like object for the given template, and its full path |
|
1126 | 1134 | |
|
1127 | 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( |
|
|
1167 | def try_open_template( | |
|
1168 | name: bytes, templatepath: Optional[bytes] = None | |
|
1169 | ) -> Tuple[Optional[bytes], Optional[BinaryIO]]: | |
|
1160 | 1170 | try: |
|
1161 | 1171 | return open_template(name, templatepath) |
|
1162 | 1172 | except (EnvironmentError, ImportError): |
General Comments 0
You need to be logged in to leave comments.
Login now