Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions tree_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,15 @@ def print(self, data, depth=0):
for _ in range((int)(depth / self._indent) - 1):
print("| ", end="")
# TODO print TimeGraphEntry specific fields below; re-enable pylint's:
# pylint: disable=consider-using-f-string
print("{0}{1} ({1}, {2}) {3}".format(
prefix, self._entry.labels[0], self._entry.id, self._entry.parent_id))
print(f'{prefix}{labels[0]} ({labels[0]}, {self._entry.id}) {self._entry.parent_id}')
else:
label_str = ""
if depth > 0:
label_str = label_str + " "
label_str += " "
for _ in range((int)(depth / self._indent) - 1):
label_str = label_str + "| "
label_str += "| "
i = 0
label_str = label_str + prefix
label_str += prefix
for label in labels:
if i == 0:
row.append(label_str + label)
Expand Down
6 changes: 2 additions & 4 deletions tsp/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ def __init__(self, params):
self.parameters = {}


# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to_string method
'''
return 'Configuration[name={0}, description={1}, id={2}, source_type_id={3}, parameters={4}]'.format(self.name,
self.description, self.id, self.source_type_id, self.parameters)
return f'Configuration[name={self.name}, description={self.description}, id={self.id}, source_type_id={self.source_type_id}, parameters={self.parameters}]'
6 changes: 2 additions & 4 deletions tsp/configuration_parameter_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ def __init__(self, params):
self.is_required = "unknown_source_type_id"


# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to_string method
'''
return 'ConfigurationParameterDescriptor[key_name={0}, description={1}, data_type={2}, is_required={3}]'.format(self.key_name,
self.description, self.data_type, self.is_required)
return f'ConfigurationParameterDescriptor[key_name={self.key_name}, description={self.description}, data_type={self.data_type}, is_required={self.is_required}]'
5 changes: 2 additions & 3 deletions tsp/configuration_parameter_descriptor_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ def __init__(self, params):
self.configuration_parameter_set.append(ConfigurationParameterDescriptor(obj))


# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to string method
'''
sep = ''
my_str = ''
for desc in self.configuration_parameter_set:
my_str = my_str + '{0}{1}\n'.format(sep, desc.to_string())
my_str = my_str + f'{sep}{desc}\n'
sep = ', '

return my_str
5 changes: 2 additions & 3 deletions tsp/configuration_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ def __init__(self, params):
self.configuration_set.append(Configuration(obj))


# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to string method
'''
my_str = ''
sep = ''
for desc in self.configuration_set:
my_str = my_str + '{0}{1}\n'.format(sep, desc.to_string())
my_str += f'{sep}{desc}\n'
sep = ', '
return my_str
8 changes: 3 additions & 5 deletions tsp/configuration_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,13 @@ def __init__(self, params):
self.parameter_descriptors = ConfigurationParameterDescriptorSet(params.get(PARAM_DESC_KEY))


# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to_string
'''
my_str = "no parameter descriptor"
if self.parameter_descriptors is not None:
my_str = self.parameter_descriptors.to_string()
my_str = str(self.parameter_descriptors)

return'Configuration Source[id={0}, name={1}, description: {2}, parameter_descriptor={3}]'.format(self.id,
self.name, self.description, my_str)
return f'Configuration Source[id={self.id}, name={self.name}, description: {self.description}, parameter_descriptor={my_str}]'

5 changes: 2 additions & 3 deletions tsp/configuration_source_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ def __init__(self, params):
for obj in params:
self.configuration_source_set.append(ConfigurationSource(obj))

# pylint: disable=consider-using-f-string
def to_string(self):
def __str__(self):
'''
to string method
'''
my_str = ''
sep = ''
for desc in self.configuration_source_set:
my_str = my_str + '{0}{1}\n'.format(sep, desc.to_string())
my_str = my_str + f'{sep}{desc}\n'
sep = ', '
return my_str

Expand Down
8 changes: 4 additions & 4 deletions tsp_cli_client
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,15 @@ if __name__ == "__main__":
if not configuration_source_set or len(configuration_source_set.configuration_source_set) == 0:
print('No configuration sources available')
else:
print(' {0}'.format(configuration_source_set.to_string()))
print(f' {configuration_source_set}')
sys.exit(0)
else:
sys.exit(1)

if options.list_configuration_source:
response = tsp_client.fetch_configuration_source(options.list_configuration_source)
if response.status_code == 200:
print(' {0}'.format(response.model.to_string()))
print(f' {response.model}')
sys.exit(0)
else:
sys.exit(1)
Expand All @@ -418,7 +418,7 @@ if __name__ == "__main__":
if not configuration_set or len(configuration_set.configuration_set) == 0:
print('No configurations loaded')
else:
print(' {0}'.format(configuration_set.to_string()))
print(f' {configuration_set}')
sys.exit(0)
else:
sys.exit(1)
Expand All @@ -428,7 +428,7 @@ if __name__ == "__main__":
if options.type_id is not None:
response = tsp_client.fetch_configuration(options.type_id, options.list_configuration)
if response.status_code == 200:
print(' {0}'.format(response.model.to_string()))
print(f' {response.model}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this leads to an error SyntaxError: unterminated string literal (detected at line 431)
You need to terminate the string

sys.exit(0)
else:
sys.exit(1)
Expand Down