diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 3d0e0565df..4c4dda76ab 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -209,8 +209,7 @@ parser.add_option('-k', '--keyspace', help='Authenticate to the given keyspace.' parser.add_option("-f", "--file", help="Execute commands from FILE, then exit") parser.add_option('--debug', action='store_true', help='Show additional debugging information') -parser.add_option("--encoding", help="Specify a non-default encoding for output." + - " (Default: %s)" % (UTF8,)) +parser.add_option("--encoding", help="Specify a non-default encoding for output. (Default: %s)" % (UTF8,)) parser.add_option("--cqlshrc", help="Specify an alternative cqlshrc file location.") parser.add_option('--cqlversion', default=DEFAULT_CQLVER, help='Specify a particular CQL version (default: %default).' @@ -2540,8 +2539,8 @@ def main(options, hostname, port): # we silently ignore and fallback to UTC unless a custom timestamp format (which likely # does contain a TZ part) was specified if options.time_format != DEFAULT_TIMESTAMP_FORMAT: - sys.stderr.write("Warning: custom timestamp format specified in cqlshrc, but local timezone could not be detected.\n" + - "Either install Python 'tzlocal' module for auto-detection or specify client timezone in your cqlshrc.\n\n") + sys.stderr.write("Warning: custom timestamp format specified in cqlshrc, but local timezone could not be detected." + + "Either install Python 'tzlocal' module for auto-detection or specify client timezone in your cqlshrc.\n\n") try: shell = Shell(hostname, diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index b28d96d190..6134119ca3 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -1872,9 +1872,9 @@ class ImportConversion(object): return ret # this should match all possible CQL datetime formats - p = re.compile("(\d{4})\-(\d{2})\-(\d{2})\s?(?:'T')?" + # YYYY-MM-DD[( |'T')] - "(?:(\d{2}):(\d{2})(?::(\d{2}))?)?" + # [HH:MM[:SS]] - "(?:([+\-])(\d{2}):?(\d{2}))?") # [(+|-)HH[:]MM]] + p = re.compile(r"(\d{4})\-(\d{2})\-(\d{2})\s?(?:'T')?" # YYYY-MM-DD[( |'T')] + + r"(?:(\d{2}):(\d{2})(?::(\d{2}))?)?" # [HH:MM[:SS]] + + r"(?:([+\-])(\d{2}):?(\d{2}))?") # [(+|-)HH[:]MM]] def convert_datetime(val, **_): try: diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index 8224ad915b..235e3009c1 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -456,8 +456,7 @@ def ks_prop_val_mapender_completer(ctxt, cass): def cf_prop_name_completer(ctxt, cass): - return [c[0] for c in (CqlRuleSet.columnfamily_layout_options + - CqlRuleSet.columnfamily_layout_map_options)] + return [c[0] for c in (CqlRuleSet.columnfamily_layout_options + CqlRuleSet.columnfamily_layout_map_options)] def cf_prop_val_completer(ctxt, cass): @@ -817,9 +816,9 @@ syntax_rules += r''' def regular_column_names(table_meta): if not table_meta or not table_meta.columns: return [] - regular_columns = list(set(table_meta.columns.keys()) - - set([key.name for key in table_meta.partition_key]) - - set([key.name for key in table_meta.clustering_key])) + regular_columns = list(set(table_meta.columns.keys()) + - set([key.name for key in table_meta.partition_key]) + - set([key.name for key in table_meta.clustering_key])) return regular_columns diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py index f95bfff559..1cd989800f 100644 --- a/pylib/cqlshlib/formatting.py +++ b/pylib/cqlshlib/formatting.py @@ -147,6 +147,7 @@ def formatter_for(typname): return f return registrator + class BlobType(object): def __init__(self, val): self.val = val @@ -154,6 +155,7 @@ class BlobType(object): def __str__(self): return str(self.val) + @formatter_for('BlobType') def format_value_blob(val, colormap, **_): bval = '0x' + binascii.hexlify(val) diff --git a/pylib/cqlshlib/wcwidth.py b/pylib/cqlshlib/wcwidth.py index 985fd41acc..554c6c8bdf 100644 --- a/pylib/cqlshlib/wcwidth.py +++ b/pylib/cqlshlib/wcwidth.py @@ -252,19 +252,19 @@ def mk_wcwidth(ucs): # if we arrive here, ucs is not a combining or C0/C1 control character return 1 + \ - int(ucs >= 0x1100 and - (ucs <= 0x115f or # Hangul Jamo init. consonants - ucs == 0x2329 or ucs == 0x232a or - (ucs >= 0x2e80 and ucs <= 0xa4cf and - ucs != 0x303f) or # CJK ... Yi - (ucs >= 0xac00 and ucs <= 0xd7a3) or # Hangul Syllables - (ucs >= 0xf900 and ucs <= 0xfaff) or # CJK Compatibility Ideographs - (ucs >= 0xfe10 and ucs <= 0xfe19) or # Vertical forms - (ucs >= 0xfe30 and ucs <= 0xfe6f) or # CJK Compatibility Forms - (ucs >= 0xff00 and ucs <= 0xff60) or # Fullwidth Forms - (ucs >= 0xffe0 and ucs <= 0xffe6) or - (ucs >= 0x20000 and ucs <= 0x2fffd) or - (ucs >= 0x30000 and ucs <= 0x3fffd))) + int(ucs >= 0x1100 + and (ucs <= 0x115f # Hangul Jamo init. consonants + or ucs == 0x2329 or ucs == 0x232a + or (ucs >= 0x2e80 and ucs <= 0xa4cf + and ucs != 0x303f) # CJK ... Yi + or (ucs >= 0xac00 and ucs <= 0xd7a3) # Hangul Syllables + or (ucs >= 0xf900 and ucs <= 0xfaff) # CJK Compatibility Ideographs + or (ucs >= 0xfe10 and ucs <= 0xfe19) # Vertical forms + or (ucs >= 0xfe30 and ucs <= 0xfe6f) # CJK Compatibility Forms + or (ucs >= 0xff00 and ucs <= 0xff60) # Fullwidth Forms + or (ucs >= 0xffe0 and ucs <= 0xffe6) + or (ucs >= 0x20000 and ucs <= 0x2fffd) + or (ucs >= 0x30000 and ucs <= 0x3fffd))) def mk_wcswidth(pwcs):