This is an automated email from the ASF dual-hosted git repository. stefania pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 2f781819b184ba306ed0cc4412441a3c444365d6 Merge: 3db7796 57b0bb9 Author: Stefania Alborghetti <stefania.alborghe...@datastax.com> AuthorDate: Thu Apr 9 09:05:14 2020 -0400 Merge branch 'cassandra-3.11' into trunk CHANGES.txt | 2 ++ pylib/cqlshlib/copyutil.py | 7 +++++-- pylib/cqlshlib/formatting.py | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --cc pylib/cqlshlib/copyutil.py index 3bed2ad,b91bb76..853893c --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@@ -56,12 -50,11 +56,12 @@@ from cassandra.metadata import protect_ from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy, DCAwareRoundRobinPolicy, FallthroughRetryPolicy from cassandra.query import BatchStatement, BatchType, SimpleStatement, tuple_factory from cassandra.util import Date, Time +from cqlshlib.util import profile_on, profile_off -from cql3handling import CqlRuleSet -from displaying import NO_COLOR_MAP -from formatting import format_value_default, CqlType, DateTimeFormat, EMPTY, get_formatter, BlobType -from sslhandling import ssl_settings +from cqlshlib.cql3handling import CqlRuleSet +from cqlshlib.displaying import NO_COLOR_MAP - from cqlshlib.formatting import format_value_default, CqlType, DateTimeFormat, EMPTY, get_formatter ++from cqlshlib.formatting import format_value_default, CqlType, DateTimeFormat, EMPTY, get_formatter, BlobType +from cqlshlib.sslhandling import ssl_settings PROFILE_ON = False STRACE_ON = False @@@ -1933,10 -1868,10 +1933,13 @@@ class ImportConversion(object) return converters.get(t.typename, convert_unknown)(v, ct=t) def convert_blob(v, **_): - return bytearray.fromhex(v[2:]) - return BlobType(v[2:].decode("hex")) ++ if sys.version_info.major >= 3: ++ return bytes.fromhex(v[2:]) ++ else: ++ return BlobType(v[2:].decode("hex")) def convert_text(v, **_): - return v + return ensure_str(v) def convert_uuid(v, **_): return UUID(v) diff --cc pylib/cqlshlib/formatting.py index 7ed6735,9927aa1..e00d91f --- a/pylib/cqlshlib/formatting.py +++ b/pylib/cqlshlib/formatting.py @@@ -239,10 -236,16 +239,16 @@@ def formatter_for(typname) return f return registrator + class BlobType(object): + def __init__(self, val): + self.val = val - @formatter_for('bytearray') + def __str__(self): + return str(self.val) + + @formatter_for('BlobType') def format_value_blob(val, colormap, **_): - bval = '0x' + binascii.hexlify(val) + bval = ensure_text('0x') + ensure_text(binascii.hexlify(val)) return colorme(bval, colormap, 'blob') --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org