MCPcopy Create free account
hub / github.com/PageBot/PageBot / path2Dir

Function path2Dir

Lib/pagebot/toolbox/transformer.py:585–603  ·  view source on GitHub ↗

Answers the file name part of the path. >>> path2Dir('/xxx/yyy/zzz/Agency_FB-Compressed.ufo') '/xxx/yyy/zzz' >>> path2Dir('a/b/c.html') 'a/b' >>> path2Dir('/a/b/d') '/a/b' >>> path2Dir('/a/b/c/') '/a/b/c' >>> path2Dir('') is None True >>> path2Dir(None) i

(path)

Source from the content-addressed store, hash-verified

583 return name
584
585def path2Dir(path):
586 """Answers the file name part of the path.
587
588 >>> path2Dir('/xxx/yyy/zzz/Agency_FB-Compressed.ufo')
589 '/xxx/yyy/zzz'
590 >>> path2Dir('a/b/c.html')
591 'a/b'
592 >>> path2Dir('/a/b/d')
593 '/a/b'
594 >>> path2Dir('/a/b/c/')
595 '/a/b/c'
596 >>> path2Dir('') is None
597 True
598 >>> path2Dir(None) is None
599 True
600 """
601 if not path:
602 return None
603 return '/'.join(path.split('/')[:-1])
604
605def path2Extension(path):
606 """Answers the file extension of path.

Callers 2

scaleImageMethod · 0.90
build_htmlMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected