Show More
@@ -24,9 +24,11 b' from typing import (' | |||
|
24 | 24 | Iterable, |
|
25 | 25 | Iterator, |
|
26 | 26 | List, |
|
27 | Match, | |
|
27 | 28 | NoReturn, |
|
28 | 29 | Optional, |
|
29 | 30 | Sequence, |
|
31 | Tuple, | |
|
30 | 32 | Union, |
|
31 | 33 | ) |
|
32 | 34 | |
@@ -65,15 +67,15 b' readlink = os.readlink' | |||
|
65 | 67 | unlink = os.unlink |
|
66 | 68 | rename = os.rename |
|
67 | 69 | removedirs = os.removedirs |
|
68 | expandglobs = False | |
|
70 | expandglobs: bool = False | |
|
69 | 71 | |
|
70 | umask = os.umask(0) | |
|
72 | umask: int = os.umask(0) | |
|
71 | 73 | os.umask(umask) |
|
72 | 74 | |
|
73 | 75 | posixfile = open |
|
74 | 76 | |
|
75 | 77 | |
|
76 | def split(p): | |
|
78 | def split(p: bytes) -> Tuple[bytes, bytes]: | |
|
77 | 79 | """Same as posixpath.split, but faster |
|
78 | 80 | |
|
79 | 81 | >>> import posixpath |
@@ -352,13 +354,13 b' def checklink(path: bytes) -> bool:' | |||
|
352 | 354 | return False |
|
353 | 355 | |
|
354 | 356 | |
|
355 | def checkosfilename(path): | |
|
357 | def checkosfilename(path: bytes) -> Optional[bytes]: | |
|
356 | 358 | """Check that the base-relative path is a valid filename on this platform. |
|
357 | 359 | Returns None if the path is ok, or a UI string describing the problem.""" |
|
358 | 360 | return None # on posix platforms, every path is ok |
|
359 | 361 | |
|
360 | 362 | |
|
361 | def getfsmountpoint(dirpath): | |
|
363 | def getfsmountpoint(dirpath: bytes) -> Optional[bytes]: | |
|
362 | 364 | """Get the filesystem mount point from a directory (best-effort) |
|
363 | 365 | |
|
364 | 366 | Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. |
@@ -410,7 +412,7 b' def normcase(path: bytes) -> bytes:' | |||
|
410 | 412 | |
|
411 | 413 | |
|
412 | 414 | # what normcase does to ASCII strings |
|
413 | normcasespec = encoding.normcasespecs.lower | |
|
415 | normcasespec: int = encoding.normcasespecs.lower | |
|
414 | 416 | # fallback normcase function for non-ASCII strings |
|
415 | 417 | normcasefallback = normcase |
|
416 | 418 | |
@@ -518,7 +520,7 b" if pycompat.sysplatform == b'cygwin':" | |||
|
518 | 520 | return False |
|
519 | 521 | |
|
520 | 522 | |
|
521 | _needsshellquote = None | |
|
523 | _needsshellquote: Optional[Match[bytes]] = None | |
|
522 | 524 | |
|
523 | 525 | |
|
524 | 526 | def shellquote(s: bytes) -> bytes: |
@@ -647,7 +649,7 b' def spawndetached(args: List[bytes]) -> ' | |||
|
647 | 649 | return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), args[0], args) |
|
648 | 650 | |
|
649 | 651 | |
|
650 | def gethgcmd(): | |
|
652 | def gethgcmd(): # TODO: convert to bytes, like on Windows? | |
|
651 | 653 | return sys.argv[:1] |
|
652 | 654 | |
|
653 | 655 |
General Comments 0
You need to be logged in to leave comments.
Login now