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

login
register
mail settings
Submitter Yuya Nishihara
Date March 22, 2018, 3:01 p.m.
Message ID <fb052525a730ad7e2aec.1521730915@mimosa>
Download mbox | patch
Permalink /patch/29783/
State Accepted
Headers show

Comments

Yuya Nishihara - March 22, 2018, 3:01 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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

Patch

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):