MCPcopy Index your code
hub / github.com/pyload/pyload / truncate

Function truncate

module/plugins/internal/misc.py:540–546  ·  view source on GitHub ↗
(name, length)

Source from the content-addressed store, hash-verified

538
539
540def truncate(name, length):
541 max_trunc = len(name) / 2
542 if length > max_trunc:
543 raise OSError("File name too long")
544
545 trunc = int((len(name) - length) / 3)
546 return "%s~%s" % (name[:trunc * 2], name[-trunc:])
547
548
549if sys.getfilesystemencoding().startswith('ANSI'):

Callers 1

safepathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected