01-speedup.patch 929 B

12345678910111213141516171819202122232425262728
  1. commit 4dc0f71a2788ed3530b053c0363738a8964f6a86
  2. author: asatarin
  3. date: 2017-10-13T16:14:43+03:00
  4. revision: 3199619
  5. REVIEW:340199 Speed up StringDescription
  6. --- contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (94523234ff338f573e50b70f8cf7f6c8456bd3a1)
  7. +++ contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (4dc0f71a2788ed3530b053c0363738a8964f6a86)
  8. @@ -24,15 +24,14 @@ def tostring(selfdescribing):
  9. class StringDescription(BaseDescription):
  10. """A :py:class:`~hamcrest.core.description.Description` that is stored as a
  11. string.
  12. -
  13. """
  14. def __init__(self):
  15. - self.out = ''
  16. + self.__out_list = []
  17. def __str__(self):
  18. """Returns the description."""
  19. - return self.out
  20. + return ''.join(self.__out_list)
  21. def append(self, string):
  22. - self.out += six.text_type(string)
  23. + self.__out_list.append(six.text_type(string))