An insane alternative to pathlib.Path and path.py.
Python3.6.0+ for formated string and "path-like".
>>> from wtfile import F
>>> f = F('/home', 'sy')
>>> f
/home/sy
>>> f = f('test.cc')
>>> f
/home/sy/test.cc
>>> f.ext
.cc
>>> f.ext('h')
/home/sy/test.h
>>> f.stem('name')
/home/sy/name.h
>>> f.name
name.h
>>> filepath = os.path.join('/home/sy', f.name)
/home/sy/name.h>>> f = F('/home/sy') / 'test.cc'
>>> f
/home/sy/test.cc
>>> f.name
test.cc
>>> 'g' + f.ext
.gcc
>>> f.ext + 'g'
.ccg>>> f = F('/home/sy', 'test.c')
>>> f.parent
/home/sy
>>> f.parent.children
[]
>>> f.touch()
>>> f.parent.children
['test.c']
>>> f.write('int main(void);').ext('h')
>>> f
/home/sy/test.h
>>> f.read()
'int main(void);'
>>> f.mtime
1553913442.148171For more evil actions you may refer to the tests.py or the upcoming docs.
It's rational at some points, though insane, it's just too aggressive if compatibilities count.
PEP 355 -- Path - Object oriented filesystem paths
PEP 428 -- The pathlib module -- object-oriented filesystem paths
PEP 519 -- Adding a file system path protocol
MIT License Copyright (c) 2019 Sy