Mercurial > hg
comparison mercurial/windows.py @ 44452:9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Built with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens
and then blackened. pyupgrade comes from
https://github.com/asottile/pyupgrade with a patch to let me preserve
extraneous parens (which we use for marking strings that shouldn't be
translated), and lets us clean up a bunch of idioms that have cruftily
accumulated over the years.
# skip-blame no-op automated code cleanups
Differential Revision: https://phab.mercurial-scm.org/D8255
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Mar 2020 13:27:41 -0500 |
parents | 70abcb614a5c |
children | 5258bffdb1d6 |
comparison
equal
deleted
inserted
replaced
44449:ff72bd52d56a | 44452:9d2b2df2c2ba |
---|---|
533 if not dir: | 533 if not dir: |
534 dir = b'.' | 534 dir = b'.' |
535 cache = dircache.get(dir, None) | 535 cache = dircache.get(dir, None) |
536 if cache is None: | 536 if cache is None: |
537 try: | 537 try: |
538 dmap = dict( | 538 dmap = { |
539 [ | 539 normcase(n): s |
540 (normcase(n), s) | 540 for n, k, s in listdir(dir, True) |
541 for n, k, s in listdir(dir, True) | 541 if getkind(s.st_mode) in _wantedkinds |
542 if getkind(s.st_mode) in _wantedkinds | 542 } |
543 ] | |
544 ) | |
545 except OSError as err: | 543 except OSError as err: |
546 # Python >= 2.5 returns ENOENT and adds winerror field | 544 # Python >= 2.5 returns ENOENT and adds winerror field |
547 # EINVAL is raised if dir is not a directory. | 545 # EINVAL is raised if dir is not a directory. |
548 if err.errno not in (errno.ENOENT, errno.EINVAL, errno.ENOTDIR): | 546 if err.errno not in (errno.ENOENT, errno.EINVAL, errno.ENOTDIR): |
549 raise | 547 raise |