Refactoring, ipathlib, and others!
This commit is contained in:
parent
b9801cad59
commit
440bd2f153
8 changed files with 64 additions and 1380 deletions
BIN
std/__pycache__/ipathlib.cpython-312.pyc
Normal file
BIN
std/__pycache__/ipathlib.cpython-312.pyc
Normal file
Binary file not shown.
21
std/ipathlib.py
Normal file
21
std/ipathlib.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import pathlib
|
||||
from typing import Self
|
||||
"""
|
||||
Pathlib without all the PAINlib.
|
||||
"""
|
||||
|
||||
class Path(pathlib.Path):
|
||||
def listdir(self: Self) -> list[Self]:
|
||||
return list(self.iterdir())
|
||||
def remove(self: Self, missing_ok: bool = True) -> None:
|
||||
"""Remove this file or link. If the path is a directory, use rmdir() instead."""
|
||||
self.unlink(missing_ok=missing_ok)
|
||||
def rmtree(self: Self):
|
||||
if self.is_file():
|
||||
self.remove()
|
||||
else:
|
||||
for child in self.iterdir():
|
||||
child.rmtree()
|
||||
self.rmdir()
|
||||
|
||||
PurePath = pathlib.PurePath
|
Loading…
Add table
Add a link
Reference in a new issue