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

Function path2ParentPath

Lib/pagebot/toolbox/transformer.py:506–515  ·  view source on GitHub ↗

>>> path2ParentPath('/xxx/yyy/zzz/') '/xxx/yyy/zzz' >>> path2ParentPath('/xxx/yyy/zzz') '/xxx/yyy' >>> path2ParentPath('/xxx/yyy/zzz.gif') '/xxx/yyy'

(path)

Source from the content-addressed store, hash-verified

504 return '/'.join((module.__file__).split('/')[:-1])
505
506def path2ParentPath(path):
507 """
508 >>> path2ParentPath('/xxx/yyy/zzz/')
509 '/xxx/yyy/zzz'
510 >>> path2ParentPath('/xxx/yyy/zzz')
511 '/xxx/yyy'
512 >>> path2ParentPath('/xxx/yyy/zzz.gif')
513 '/xxx/yyy'
514 """
515 return '/'.join(path.split('/')[:-1])
516
517def path2Url(path):
518 """Convert the path to a valid url, by removing spaces, other inconvenient

Callers 4

font2FamilyIDFunction · 0.85
buildMethod · 0.85
buildMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected