Fix flake8 errors

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
Christophe Bedard 2020-05-23 09:33:42 -04:00
parent 0c592bb179
commit c0a523328d
2 changed files with 13 additions and 13 deletions

View file

@ -67,14 +67,14 @@ class MemoryUsageDataModelUtil(DataModelUtil):
:param precision: the number of digits to display after the period
"""
suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffixIndex = 0
suffix_index = 0
mem_size = float(size)
while mem_size > 1024.0 and suffixIndex < 4:
while mem_size > 1024.0 and suffix_index < 4:
# Increment the index of the suffix
suffixIndex += 1
suffix_index += 1
# Apply the division
mem_size = mem_size / 1024.0
return f'{mem_size:.{precision}f} {suffixes[suffixIndex]}'
return f'{mem_size:.{precision}f} {suffixes[suffix_index]}'
def get_max_memory_usage_per_tid(self) -> DataFrame:
"""

View file

@ -64,13 +64,13 @@ class Ros2DataModelUtil(DataModelUtil):
# remove spaces
pretty = pretty.replace(' ', '')
# allocator
STD_ALLOCATOR = '_<std::allocator<void>>'
pretty = pretty.replace(STD_ALLOCATOR, '')
std_allocator = '_<std::allocator<void>>'
pretty = pretty.replace(std_allocator, '')
# default_delete
STD_DEFAULTDELETE = 'std::default_delete'
if STD_DEFAULTDELETE in pretty:
dd_start = pretty.find(STD_DEFAULTDELETE)
template_param_open = dd_start + len(STD_DEFAULTDELETE)
std_defaultdelete = 'std::default_delete'
if std_defaultdelete in pretty:
dd_start = pretty.find(std_defaultdelete)
template_param_open = dd_start + len(std_defaultdelete)
# find index of matching/closing GT sign
template_param_close = template_param_open
level = 0
@ -86,10 +86,10 @@ class Ros2DataModelUtil(DataModelUtil):
level -= 1
pretty = pretty[:dd_start] + pretty[(template_param_close + 1):]
# bind
STD_BIND = 'std::_Bind<'
if pretty.startswith(STD_BIND):
std_bind = 'std::_Bind<'
if pretty.startswith(std_bind):
# remove bind<>
pretty = pretty.replace(STD_BIND, '')
pretty = pretty.replace(std_bind, '')
pretty = pretty[:-1]
# remove placeholder stuff
placeholder_from = pretty.find('*')