Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 37084:191cba70fe27
util: mark internal constants of escapedata() as private
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 22 Mar 2018 21:20:47 +0900 |
parents | bad90b80b315 |
children | 1a1d1c44b570 |
comparison
equal
deleted
inserted
replaced
37083:bad90b80b315 | 37084:191cba70fe27 |
---|---|
807 | 807 |
808 def setsockopt(self, *args, **kwargs): | 808 def setsockopt(self, *args, **kwargs): |
809 return object.__getattribute__(self, r'_observedcall')( | 809 return object.__getattribute__(self, r'_observedcall')( |
810 r'setsockopt', *args, **kwargs) | 810 r'setsockopt', *args, **kwargs) |
811 | 811 |
812 DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)} | 812 _DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)} |
813 DATA_ESCAPE_MAP.update({ | 813 _DATA_ESCAPE_MAP.update({ |
814 b'\\': b'\\\\', | 814 b'\\': b'\\\\', |
815 b'\r': br'\r', | 815 b'\r': br'\r', |
816 b'\n': br'\n', | 816 b'\n': br'\n', |
817 }) | 817 }) |
818 DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]') | 818 _DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]') |
819 | 819 |
820 def escapedata(s): | 820 def escapedata(s): |
821 if isinstance(s, bytearray): | 821 if isinstance(s, bytearray): |
822 s = bytes(s) | 822 s = bytes(s) |
823 | 823 |
824 return DATA_ESCAPE_RE.sub(lambda m: DATA_ESCAPE_MAP[m.group(0)], s) | 824 return _DATA_ESCAPE_RE.sub(lambda m: _DATA_ESCAPE_MAP[m.group(0)], s) |
825 | 825 |
826 class baseproxyobserver(object): | 826 class baseproxyobserver(object): |
827 def _writedata(self, data): | 827 def _writedata(self, data): |
828 if not self.logdata: | 828 if not self.logdata: |
829 if self.logdataapis: | 829 if self.logdataapis: |