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