Skip to content

Commit

Permalink
Avoid assignment from None (#1113)
Browse files Browse the repository at this point in the history
With this commit we reenable the pylint warning `assignment-from-none`
which checks whether a `None` return value from a function is assigned
to a variable. We also audited all such issues in the code and disabled
the warning accordingly.

Relates #838
  • Loading branch information
danielmitterdorfer authored Nov 19, 2020
1 parent acde0b9 commit d81f895
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ disable=print-statement,
W0613,
W0621,
invalid-docstring-quote,
raise-missing-from,
assignment-from-none
raise-missing-from


# Enable the message, report, category or checker with the given id(s). You can
Expand Down
4 changes: 4 additions & 0 deletions esrally/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ def joinpoint_reached(self, worker_id, worker_local_timestamp, task_allocations)
if self.finished():
self.telemetry.on_benchmark_stop()
self.logger.info("All steps completed.")
# Some metrics store implementations return None because no external representation is required.
# pylint: disable=assignment-from-none
m = self.metrics_store.to_externalizable(clear=True)
self.logger.debug("Closing metrics store...")
self.metrics_store.close()
Expand All @@ -539,6 +541,8 @@ def move_to_next_task(self, workers_curr_step):
# Assumption: We don't have a lot of clock skew between reaching the join point and sending the next task
# (it doesn't matter too much if we're a few ms off).
waiting_period = 1.0
# Some metrics store implementations return None because no external representation is required.
# pylint: disable=assignment-from-none
m = self.metrics_store.to_externalizable(clear=True)
self.target.on_task_finished(m, waiting_period)
# Using a perf_counter here is fine also in the distributed case as we subtract it from `master_received_msg_at` making it
Expand Down

0 comments on commit d81f895

Please sign in to comment.