comparison mercurial/ui.py @ 41768:aaad36b88298

cleanup: use () to wrap long lines instead of \ This is a little less brittle, and often helps indentation. In a surprising number of cases the entire cleanup was deleting the \, as the expression was *already* parenthesized in a workable way. Differential Revision: https://phab.mercurial-scm.org/D5993
author Augie Fackler <augie@google.com>
date Wed, 20 Feb 2019 19:28:51 -0500
parents 97ab4cbb342e
children 8e364664a999
comparison
equal deleted inserted replaced
41767:15d3facfa40a 41768:aaad36b88298
342 # this is open-coded below - search for timeblockedsection to find them 342 # this is open-coded below - search for timeblockedsection to find them
343 starttime = util.timer() 343 starttime = util.timer()
344 try: 344 try:
345 yield 345 yield
346 finally: 346 finally:
347 self._blockedtimes[key + '_blocked'] += \ 347 self._blockedtimes[key + '_blocked'] += (
348 (util.timer() - starttime) * 1000 348 (util.timer() - starttime) * 1000)
349 349
350 @contextlib.contextmanager 350 @contextlib.contextmanager
351 def uninterruptible(self): 351 def uninterruptible(self):
352 """Mark an operation as unsafe. 352 """Mark an operation as unsafe.
353 353
1025 msg = self.label(msg, label) 1025 msg = self.label(msg, label)
1026 dest.write(msg) 1026 dest.write(msg)
1027 except IOError as err: 1027 except IOError as err:
1028 raise error.StdioError(err) 1028 raise error.StdioError(err)
1029 finally: 1029 finally:
1030 self._blockedtimes['stdio_blocked'] += \ 1030 self._blockedtimes['stdio_blocked'] += (
1031 (util.timer() - starttime) * 1000 1031 (util.timer() - starttime) * 1000)
1032 1032
1033 def write_err(self, *args, **opts): 1033 def write_err(self, *args, **opts):
1034 self._write(self._ferr, *args, **opts) 1034 self._write(self._ferr, *args, **opts)
1035 1035
1036 def _write(self, dest, *args, **opts): 1036 def _write(self, dest, *args, **opts):
1076 and err.errno in (errno.EPIPE, errno.EIO, errno.EBADF)): 1076 and err.errno in (errno.EPIPE, errno.EIO, errno.EBADF)):
1077 # no way to report the error, so ignore it 1077 # no way to report the error, so ignore it
1078 return 1078 return
1079 raise error.StdioError(err) 1079 raise error.StdioError(err)
1080 finally: 1080 finally:
1081 self._blockedtimes['stdio_blocked'] += \ 1081 self._blockedtimes['stdio_blocked'] += (
1082 (util.timer() - starttime) * 1000 1082 (util.timer() - starttime) * 1000)
1083 1083
1084 def _writemsg(self, dest, *args, **opts): 1084 def _writemsg(self, dest, *args, **opts):
1085 _writemsgwith(self._write, dest, *args, **opts) 1085 _writemsgwith(self._write, dest, *args, **opts)
1086 1086
1087 def _writemsgnobuf(self, dest, *args, **opts): 1087 def _writemsgnobuf(self, dest, *args, **opts):
1101 self._ferr.flush() 1101 self._ferr.flush()
1102 except IOError as err: 1102 except IOError as err:
1103 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): 1103 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
1104 raise error.StdioError(err) 1104 raise error.StdioError(err)
1105 finally: 1105 finally:
1106 self._blockedtimes['stdio_blocked'] += \ 1106 self._blockedtimes['stdio_blocked'] += (
1107 (util.timer() - starttime) * 1000 1107 (util.timer() - starttime) * 1000)
1108 1108
1109 def _isatty(self, fh): 1109 def _isatty(self, fh):
1110 if self.configbool('ui', 'nontty'): 1110 if self.configbool('ui', 'nontty'):
1111 return False 1111 return False
1112 return procutil.isatty(fh) 1112 return procutil.isatty(fh)