comparison mercurial/util.py @ 51796:62806be5cbda

typing: add hints to `mercurial.util.mktempcopy()` Might as well, now that the previous commit indicated what types are required.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Aug 2024 14:22:26 -0400
parents b619ba39d10a
children f5c46c3518a5
comparison
equal deleted inserted replaced
51795:1888846a1ee2 51796:62806be5cbda
2430 It is recommended to use os.path.normpath() before using this 2430 It is recommended to use os.path.normpath() before using this
2431 function if need.""" 2431 function if need."""
2432 return path.split(pycompat.ossep) 2432 return path.split(pycompat.ossep)
2433 2433
2434 2434
2435 def mktempcopy(name, emptyok=False, createmode=None, enforcewritable=False): 2435 def mktempcopy(
2436 name: bytes,
2437 emptyok: bool = False,
2438 createmode: Optional[int] = None,
2439 enforcewritable: bool = False,
2440 ) -> bytes:
2436 """Create a temporary file with the same contents from name 2441 """Create a temporary file with the same contents from name
2437 2442
2438 The permission bits are copied from the original file. 2443 The permission bits are copied from the original file.
2439 2444
2440 If the temporary file is going to be truncated immediately, you 2445 If the temporary file is going to be truncated immediately, you