Skip to content

Commit

Permalink
Upgrading pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jul 15, 2017
1 parent 8043d40 commit 2352c61
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
@@ -1,5 +1,5 @@
[MESSAGES CONTROL]
disable=E1103,I0011,I0012,C0301,C0302,C0325,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0105,W0122,W0141,W0142,W0201,W0212,W0221,W0232,W0511,W0603,W0611,W0622,W0612,W0613,W0702,W0703,W1401,W0110,C0411,C0413,R0204
disable=E1103,I0011,I0012,C0301,C0302,C0325,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0105,W0122,W0141,W0142,W0201,W0212,W0221,W0232,W0511,W0603,W0611,W0622,W0612,W0613,W0702,W0703,W1401,W0110,C0411,C0413,R0204,R1705,C0412

[BASIC]
argument-rgx=[a-z_][a-z0-9_]{0,30}$
Expand Down
17 changes: 9 additions & 8 deletions dql/cli.py
Expand Up @@ -89,7 +89,7 @@ def promptyn(msg, default=None):
return True
elif confirm in ('n', 'no'):
return False
elif len(confirm) == 0 and default is not None:
elif not confirm and default is not None:
return default


Expand Down Expand Up @@ -303,7 +303,7 @@ def complete_opt(self, text, line, begidx, endidx):
if name.startswith('opt_' + text)]
method = getattr(self, 'complete_opt_' + option, None)
if method is not None:
return method(text, line, begidx, endidx)
return method(text, line, begidx, endidx) # pylint: disable=E1102

def opt_width(self, width):
""" Set width of output ('auto' will auto-detect terminal width) """
Expand Down Expand Up @@ -446,9 +446,10 @@ def do_ls(self, table=None):
six.print_(title.ljust(size), end='')
six.print_()
# Print each table row
for table in tables:
for row_table in tables:
for size, field in zip(sizes, fields.values()):
six.print_(str(getattr(table, field)).ljust(size), end='')
six.print_(str(getattr(row_table, field)).ljust(size),
end='')
six.print_()
else:
six.print_(self.engine.describe(table, refresh=True,
Expand Down Expand Up @@ -531,7 +532,7 @@ def do_throttle(self, *args):
self.throttle.set_total_limit(read, write)
else:
self.throttle.set_table_limit(tablename, read, write)
elif len(args) == 0:
elif not args:
self.throttle.set_total_limit(read, write)
else:
return self.onecmd('help throttle')
Expand All @@ -555,7 +556,7 @@ def do_unthrottle(self, *args):
> unthrottle mytable myindex
"""
if len(args) == 0:
if not args:
if promptyn("Are you sure you want to clear all throttles?"):
self.throttle.load({})
elif len(args) == 1:
Expand Down Expand Up @@ -612,9 +613,9 @@ def _run_cmd(self, command):
formatter.display()
print_count = 0
total = None
for (command, capacity) in self.engine.consumed_capacities:
for (cmd_fragment, capacity) in self.engine.consumed_capacities:
total += capacity
six.print_(command)
six.print_(cmd_fragment)
six.print_(indent(str(capacity)))
print_count += 1
if print_count > 1:
Expand Down
6 changes: 3 additions & 3 deletions dql/engine.py
Expand Up @@ -226,7 +226,7 @@ def _get_metric(self, metric, tablename, index_name=None):
Dimensions=dimensions,
)
points = data['Datapoints']
if len(points) == 0:
if not points:
return 0
else:
points.sort(key=lambda r: r['Timestamp'])
Expand Down Expand Up @@ -410,7 +410,7 @@ def _build_query(self, table, tree, visitor):
# See if we can find an index to query on
indexes = table.get_matching_indexes(possible_hash,
possible_range)
if len(indexes) == 0:
if not indexes:
action = 'scan'
kwargs['filter'] = constraints.build(visitor)
kwargs['expr_values'] = visitor.expression_values
Expand Down Expand Up @@ -634,7 +634,7 @@ def _query_and_op(self, tree, table, method_name, method_kwargs):
try:
list(keys)
except ExplainSignal:
keys = [{}] # pylint: disable=R0204
keys = [{}]

method = getattr(self.connection, method_name + '2')
count = 0
Expand Down
2 changes: 1 addition & 1 deletion dql/expressions/constraint.py
Expand Up @@ -204,7 +204,7 @@ def remove_index(self, index):
query_constraints = query[0]
else:
query_constraints = Conjunction.and_(query)
if len(remainder) == 0:
if not remainder:
filter_constraints = None
elif len(remainder) == 1:
filter_constraints = remainder[0]
Expand Down
2 changes: 1 addition & 1 deletion dql/output.py
Expand Up @@ -194,7 +194,7 @@ def write(self, result):
pass
else:
val = format_json(data, max_key + 3)
elif isinstance(val, dict) or isinstance(val, list):
elif isinstance(val, (dict, list)):
val = format_json(val, max_key + 3)
else:
val = wrap(self.format_field(val), self.width - max_key - 3,
Expand Down
6 changes: 3 additions & 3 deletions dql/throttle.py
Expand Up @@ -121,9 +121,9 @@ def __str__(self):
lines.append("Total: %(read)s, %(write)s" % self.total)
if self.default:
lines.append("Default: %(read)s, %(write)s" % self.default)
for tablename, limit in six.iteritems(self.tables):
lines.append("%s: %s, %s" % (tablename, limit['read'],
limit['write']))
for tablename, table_limit in six.iteritems(self.tables):
lines.append("%s: %s, %s" % (tablename, table_limit['read'],
table_limit['write']))
indexes = self.indexes.get(tablename, {})
for indexname, limit in six.iteritems(indexes):
lines.append("%s:%s: %s, %s" % (tablename, indexname,
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
@@ -1,4 +1,4 @@
pylint==1.5.0
pylint==1.7.2
pep8
autopep8
sphinx
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -19,7 +19,7 @@ deps =
nose
mock
coverage
pylint==1.5.0
pylint==1.7.2
pep8
commands =
coverage run --source=dql --branch setup.py nosetests --verbosity=2
Expand Down

0 comments on commit 2352c61

Please sign in to comment.