##// END OF EJS Templates
Use slicing instead of condition
David Dorfman -
Show More
@@ -47,11 +47,11 b' def _elide_point(string:str, *, min_elide=30)->str:'
47 if file_parts[-1] == '':
47 if file_parts[-1] == '':
48 file_parts.pop()
48 file_parts.pop()
49
49
50 if len(object_parts) > 3 and object_parts[1] and object_parts[-2]:
50 if len(object_parts) > 3:
51 return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(object_parts[0], object_parts[1][0], object_parts[-2][-1], object_parts[-1])
51 return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(object_parts[0], object_parts[1][:1], object_parts[-2][-1:], object_parts[-1])
52
52
53 elif len(file_parts) > 3 and file_parts[1] and file_parts[-2]:
53 elif len(file_parts) > 3:
54 return ('{}' + os.sep + '{}\N{HORIZONTAL ELLIPSIS}{}' + os.sep + '{}').format(file_parts[0], file_parts[1][0], file_parts[-2][-1], file_parts[-1])
54 return ('{}' + os.sep + '{}\N{HORIZONTAL ELLIPSIS}{}' + os.sep + '{}').format(file_parts[0], file_parts[1][:1], file_parts[-2][-1:], file_parts[-1])
55
55
56 return string
56 return string
57
57
General Comments 0
You need to be logged in to leave comments. Login now