Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 51716:e618a1756b08
typing: avoid some useless @overload definitions in `mercurial.util`
Apparently pytype considered the name as well as the type of each argument, and
generates @overload definitions if they don't match. At best this is clutter,
and can easily be removed.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 19 Jul 2024 16:38:53 -0400 |
parents | f3b34386d3e0 |
children | 1888846a1ee2 |
comparison
equal
deleted
inserted
replaced
51715:7558cee89655 | 51716:e618a1756b08 |
---|---|
384 """Check that the base-relative path is a valid filename on this platform. | 384 """Check that the base-relative path is a valid filename on this platform. |
385 Returns None if the path is ok, or a UI string describing the problem.""" | 385 Returns None if the path is ok, or a UI string describing the problem.""" |
386 return None # on posix platforms, every path is ok | 386 return None # on posix platforms, every path is ok |
387 | 387 |
388 | 388 |
389 def getfsmountpoint(dirpath: bytes) -> Optional[bytes]: | 389 def getfsmountpoint(path: bytes) -> Optional[bytes]: |
390 """Get the filesystem mount point from a directory (best-effort) | 390 """Get the filesystem mount point from a directory (best-effort) |
391 | 391 |
392 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. | 392 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. |
393 """ | 393 """ |
394 return getattr(osutil, 'getfsmountpoint', lambda x: None)(dirpath) | 394 return getattr(osutil, 'getfsmountpoint', lambda x: None)(path) |
395 | 395 |
396 | 396 |
397 def getfstype(dirpath: bytes) -> Optional[bytes]: | 397 def getfstype(path: bytes) -> Optional[bytes]: |
398 """Get the filesystem type name from a directory (best-effort) | 398 """Get the filesystem type name from a directory (best-effort) |
399 | 399 |
400 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. | 400 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. |
401 """ | 401 """ |
402 return getattr(osutil, 'getfstype', lambda x: None)(dirpath) | 402 return getattr(osutil, 'getfstype', lambda x: None)(path) |
403 | 403 |
404 | 404 |
405 def get_password() -> bytes: | 405 def get_password() -> bytes: |
406 return encoding.strtolocal(getpass.getpass('')) | 406 return encoding.strtolocal(getpass.getpass('')) |
407 | 407 |
689 os.mkdir(path) | 689 os.mkdir(path) |
690 | 690 |
691 | 691 |
692 def lookupreg( | 692 def lookupreg( |
693 key: bytes, | 693 key: bytes, |
694 name: Optional[bytes] = None, | 694 valname: Optional[bytes] = None, |
695 scope: Optional[Union[int, Iterable[int]]] = None, | 695 scope: Optional[Union[int, Iterable[int]]] = None, |
696 ) -> Optional[bytes]: | 696 ) -> Optional[bytes]: |
697 return None | 697 return None |
698 | 698 |
699 | 699 |