Fix bandit [B101:assert_used]

This patch set refactors the usage of assert in the python code.
The current implementation does not emit assert statement when optimization
is requested at compile time (with command line option -O).  Thus, it
may not be behaving the way one assumes.

Change-Id: If2f2cac86eeae1de5974971b50a2342d8458e97c
This commit is contained in:
Tin Lam 2017-10-03 00:19:58 -05:00
parent 8bf4f7407d
commit 47b8d4d035
1 changed files with 1 additions and 3 deletions

View File

@ -648,9 +648,7 @@ def revision_tag_create(revision_id, tag, data=None, session=None):
session = session or get_session()
tag_model = models.RevisionTag()
try:
assert not data or isinstance(data, dict)
except AssertionError:
if data and not isinstance(data, dict):
raise errors.RevisionTagBadFormat(data=data)
try: