コード例 #1
0
    def encode_key(self, key):
        """
        Escape a given key bytes with the instance chosen escape method.

        Key is not escaped if it contains only 'ASCII printable' bytes.
        """
        return apply_escape_bytes(key, self._escape, skip_printable=True)
コード例 #2
0
ファイル: parser.py プロジェクト: drunkcz/redis-rdb-tools
    def encode_key(self, key):
        """
        Escape a given key bytes with the instance chosen escape method.

        Key is not escaped if it contains only 'ASCII printable' bytes.
        """
        return apply_escape_bytes(key, self._escape, skip_printable=True)
コード例 #3
0
 def encode_value(self, val):
     """Escape a given value bytes with the instance chosen escape method."""
     return apply_escape_bytes(val, self._escape)
コード例 #4
0
ファイル: callbacks.py プロジェクト: zzjzzb/redis-rdb-tools
 def emit(self, *args):
     self._out.write(codecs.encode("*%s\r\n" % len(args), 'ascii'))
     for arg in args:
         val = encodehelpers.apply_escape_bytes(arg, self._escape)
         self._out.write(codecs.encode("$%s\r\n" % len(val), 'ascii'))
         self._out.write(val + b"\r\n")
コード例 #5
0
ファイル: parser.py プロジェクト: drunkcz/redis-rdb-tools
 def encode_value(self, val):
     """Escape a given value bytes with the instance chosen escape method."""
     return apply_escape_bytes(val, self._escape)
コード例 #6
0
ファイル: callbacks.py プロジェクト: drunkcz/redis-rdb-tools
 def emit(self, *args):
     self._out.write(codecs.encode("*%s\r\n" % len(args), 'ascii'))
     for arg in args:
         val = encodehelpers.apply_escape_bytes(arg, self._escape)
         self._out.write(codecs.encode("$%s\r\n" % len(val), 'ascii'))
         self._out.write(val + b"\r\n")