Add the method to get formated item name and count.
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-06-20 16:53:02 +03:00
parent 17508461e4
commit 3c94432cfb
2 changed files with 38 additions and 0 deletions
+15
View File
@@ -17,3 +17,18 @@ class ItemFormatter(AbstractFormatter):
return formated_message
def get_name_and_count_from_parts(self, parts: list):
line = " ".join(parts)
if not ', ' in line:
return {
'error': 'Не правильний формат'
}
name, count = line.split(', ')
return {
'name': name,
'count': int(count)
}