def check_is_readonly(self, fname):
'''
Returns `True` if @fname is read-only on the filesystem.
@fname
Path to a file.
'''
if not fname:
return
try:
mode = os.stat(fname)
read_only = (stat.S_IMODE(mode.st_mode) & stat.S_IWUSR != stat.S_IWUSR)
except FileNotFoundError:
return
return read_only
评论列表
文章目录