[PATCH 4 of 8] util: mark internal constants of escapedata() as private

Yuya Nishihara yuya at tcha.org
Thu Mar 22 11:01:55 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1521721247 -32400
#      Thu Mar 22 21:20:47 2018 +0900
# Node ID fb052525a730ad7e2aeca8af22c4a66536921a79
# Parent  139e8a7b093d254d6c92598a06c9ae1d958a483b
util: mark internal constants of escapedata() as private

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -809,19 +809,19 @@ class socketproxy(object):
         return object.__getattribute__(self, r'_observedcall')(
             r'setsockopt', *args, **kwargs)
 
-DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)}
-DATA_ESCAPE_MAP.update({
+_DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)}
+_DATA_ESCAPE_MAP.update({
     b'\\': b'\\\\',
     b'\r': br'\r',
     b'\n': br'\n',
 })
-DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]')
+_DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]')
 
 def escapedata(s):
     if isinstance(s, bytearray):
         s = bytes(s)
 
-    return DATA_ESCAPE_RE.sub(lambda m: DATA_ESCAPE_MAP[m.group(0)], s)
+    return _DATA_ESCAPE_RE.sub(lambda m: _DATA_ESCAPE_MAP[m.group(0)], s)
 
 class baseproxyobserver(object):
     def _writedata(self, data):


More information about the Mercurial-devel mailing list