Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/sqlalchemy_utils/utils.py: 70%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1from collections.abc import Iterable 

2 

3 

4def str_coercible(cls): 

5 def __str__(self): 

6 return self.__unicode__() 

7 

8 cls.__str__ = __str__ 

9 return cls 

10 

11 

12def is_sequence(value): 

13 return isinstance(value, Iterable) and not isinstance(value, str) 

14 

15 

16def starts_with(iterable, prefix): 

17 """ 

18 Returns whether or not given iterable starts with given prefix. 

19 """ 

20 return list(iterable)[0 : len(prefix)] == list(prefix)