remove 'shorten_path()' and 'shorten_filename()'

This commit is contained in:
Mike Fährmann
2018-04-15 18:44:13 +02:00
parent 27eab4e467
commit 4ffa94f634
2 changed files with 0 additions and 41 deletions

View File

@@ -8,7 +8,6 @@
"""Collection of functions that work in strings/text"""
import sys
import re
import os.path
import html
@@ -78,19 +77,6 @@ def clean_path_posix(path):
return ""
def shorten_path(path, limit=255, encoding=sys.getfilesystemencoding()):
"""Shorten a path segment to at most 'limit' bytes"""
return (path.encode(encoding)[:limit]).decode(encoding, "ignore")
def shorten_filename(fname, limit=255, encoding=sys.getfilesystemencoding()):
"""Shorten filename to at most 'limit' bytes while preserving extension"""
name, extension = os.path.splitext(fname)
bext = extension.encode(encoding)
bname = name.encode(encoding)[:limit-len(bext)]
return bname.decode(encoding, "ignore") + extension
def extract(txt, begin, end, pos=0):
"""Extract the text between 'begin' and 'end' from 'txt'