Exemple #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)
Exemple #2
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)
Exemple #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)
Exemple #4
0
 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")
Exemple #5
0
 def encode_value(self, val):
     """Escape a given value bytes with the instance chosen escape method."""
     return apply_escape_bytes(val, self._escape)
Exemple #6
0
 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")