diff mercurial/worker.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 2372284d9457
children 9f70512ae2cf
line wrap: on
line diff
--- a/mercurial/worker.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/worker.py	Sun Oct 06 09:48:39 2019 -0400
@@ -44,7 +44,7 @@
 
     # windows
     try:
-        n = int(encoding.environ['NUMBER_OF_PROCESSORS'])
+        n = int(encoding.environ[b'NUMBER_OF_PROCESSORS'])
         if n > 0:
             return n
     except (KeyError, ValueError):
@@ -54,14 +54,14 @@
 
 
 def _numworkers(ui):
-    s = ui.config('worker', 'numcpus')
+    s = ui.config(b'worker', b'numcpus')
     if s:
         try:
             n = int(s)
             if n >= 1:
                 return n
         except ValueError:
-            raise error.Abort(_('number of cpus must be an integer'))
+            raise error.Abort(_(b'number of cpus must be an integer'))
     return min(max(countcpus(), 4), 32)
 
 
@@ -115,7 +115,7 @@
     a thread-based worker. Should be disabled for CPU heavy tasks that don't
     release the GIL.
     '''
-    enabled = ui.configbool('worker', 'enabled')
+    enabled = ui.configbool(b'worker', b'enabled')
     if enabled and worthwhile(ui, costperarg, len(args), threadsafe=threadsafe):
         return _platformworker(ui, func, staticargs, args, hasretval)
     return func(*staticargs + (args,))
@@ -331,8 +331,8 @@
                 # task and does not get to handle the interruption.
                 ui.warn(
                     _(
-                        "failed to kill worker threads while "
-                        "handling an exception\n"
+                        b"failed to kill worker threads while "
+                        b"handling an exception\n"
                     )
                 )
                 return