Skip to content

Commit ae8ea8d

Browse files
scivisiondpgeorge
authored andcommitted
os-path: Implement os.path.isfile().
Signed-off-by: Michael Hirsch <michael@scivision.dev>
1 parent f672baa commit ae8ea8d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

python-stdlib/os-path/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(version="0.1.4")
1+
metadata(version="0.2.0")
22

33
# Originally written by Paul Sokolovsky.
44

python-stdlib/os-path/os/path.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ def isdir(path):
6666
return False
6767

6868

69+
def isfile(path):
70+
try:
71+
return bool(os.stat(path)[0] & 0x8000)
72+
except OSError:
73+
return False
74+
75+
6976
def expanduser(s):
7077
if s == "~" or s.startswith("~/"):
7178
h = os.getenv("HOME")

python-stdlib/os-path/test_path.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@
2020
assert isdir(dir + "/os")
2121
assert not isdir(dir + "/os--")
2222
assert not isdir(dir + "/test_path.py")
23+
24+
assert not isfile(dir + "/os")
25+
assert isfile(dir + "/test_path.py")
26+
assert not isfile(dir + "/test_path.py--")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy