os-path: Implement os.path.isfile().

Signed-off-by: Michael Hirsch <michael@scivision.dev>
pull/764/head
scivision 2023-09-13 20:02:59 -04:00 zatwierdzone przez Damien George
rodzic f672baa92b
commit ae8ea8d113
3 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
metadata(version="0.1.4")
metadata(version="0.2.0")
# Originally written by Paul Sokolovsky.

Wyświetl plik

@ -66,6 +66,13 @@ def isdir(path):
return False
def isfile(path):
try:
return bool(os.stat(path)[0] & 0x8000)
except OSError:
return False
def expanduser(s):
if s == "~" or s.startswith("~/"):
h = os.getenv("HOME")

Wyświetl plik

@ -20,3 +20,7 @@ assert not exists(dir + "/test_path.py--")
assert isdir(dir + "/os")
assert not isdir(dir + "/os--")
assert not isdir(dir + "/test_path.py")
assert not isfile(dir + "/os")
assert isfile(dir + "/test_path.py")
assert not isfile(dir + "/test_path.py--")