Skip to content

Commit

Permalink
Clean up format strings
Browse files Browse the repository at this point in the history
It is better to format the string all at once instead of using
both formatting and concatenate.
  • Loading branch information
gunthercox committed Aug 16, 2020
1 parent 1c5073b commit 13fa692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions chatterbot/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def get_file_path(dotted_path, extension='json'):

corpus_path = os.path.join(*parts)

if os.path.exists(corpus_path + '.{}'.format(extension)):
corpus_path += '.{}'.format(extension)
path_with_extension = '{}.{}'.format(corpus_path, extension)
if os.path.exists(path_with_extension):
corpus_path = path_with_extension

return corpus_path

Expand Down
3 changes: 2 additions & 1 deletion chatterbot/logic/mathematical_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def process(self, statement, additional_response_selection_parameters=None):
response = Statement(text=expression)

try:
response.text += ' = ' + str(
response.text = '{} = {}'.format(
response.text,
mathparse.parse(expression, language=self.language.ISO_639.upper())
)

Expand Down

0 comments on commit 13fa692

Please sign in to comment.