Fix pycodestyle compliance

Patch by Aleksandr Sorokoumov; reviewed by Ekaterina Dimitrova and Brandon Williams for CASSANDRA-15985
This commit is contained in:
Aleksandr Sorokoumov 2021-01-12 19:51:28 +01:00 committed by Ekaterina Dimitrova
parent cb0e4386d8
commit d3ddb190ee
5 changed files with 25 additions and 25 deletions

View File

@ -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,

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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):