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)
| 583 | return name |
| 584 | |
| 585 | def 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 | |
| 605 | def path2Extension(path): |
| 606 | """Answers the file extension of path. |
no outgoing calls
no test coverage detected