kopia lustrzana https://github.com/micropython/micropython-lib
os-path: Implement os.path.isfile().
Signed-off-by: Michael Hirsch <michael@scivision.dev>pull/764/head
rodzic
f672baa92b
commit
ae8ea8d113
|
@ -1,4 +1,4 @@
|
|||
metadata(version="0.1.4")
|
||||
metadata(version="0.2.0")
|
||||
|
||||
# Originally written by Paul Sokolovsky.
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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--")
|
||||
|
|
Ładowanie…
Reference in New Issue