All Samples(3838) | Call(3789) | Derive(0) | Import(49)
access(path, mode) -> True if granted, False otherwise Use the real uid/gid to test for access to a path. Note that most operations will use the effective uid/gid, therefore this routine can be used in a suid/sgid environment to test if the invoking user has the specified access to the path. The mode argument can be F_OK to test existence, or the inclusive-OR of R_OK, W_OK, and X_OK.
src/m/o/morphix-HEAD/trunk/ibuild/src/intellibuild/clientlib/accessors/filesystem.py morphix(Download)
def Exists(self, file_name):
""" 1 if granted, 0 otherwise """
from os import access
return access(self, file_name,F_OK)
def GetReadHandle(self, file_name):
return file(file_name, 'r')
src/m/o/morphix-HEAD/trunk/ibuild/src/intellibuild/clientlib/accessors/fs.py morphix(Download)
except Exception, e:
# report the unsuccess and tell what's going on.
self.log.warn("Could not copy " + src + " to " + dst + " due to exception: " + str(e))
if os.access(src,R_OK):
self.log.debug("Source: " + src + " is readable")
if os.access(src,X_OK) and os.path.isdir(src):
self.log.debug("Source directory " + src + " is executable")
if os.access(dst,R_OK):
self.log.debug("Destination: " + dst + " is readable")
if os.access(dst,X_OK):
self.log.debug("Destination: " + dst + " is executable")
if os.access(dst,W_OK):
def exists(self, file_name):
"""
Checks for existence of an filesystem object:
1 if exists, 0 if not.
"""
from os import access
from os import F_OK
return access(file_name, F_OK)
src/m/o/morphix-HEAD/ibuild/src/intellibuild/clientlib/accessors/filesystem.py morphix(Download)
def Exists(self, file_name):
""" 1 if granted, 0 otherwise """
from os import access
return access(self, file_name,F_OK)
def GetReadHandle(self, file_name):
return file(file_name, 'r')
src/m/o/morphix-HEAD/ibuild/src/intellibuild/clientlib/accessors/fs.py morphix(Download)
except Exception, e:
# report the unsuccess and tell what's going on.
self.log.warn("Could not copy " + src + " to " + dst + " due to exception: " + str(e))
if os.access(src,R_OK):
self.log.debug("Source: " + src + " is readable")
if os.access(src,X_OK) and os.path.isdir(src):
self.log.debug("Source directory " + src + " is executable")
if os.access(dst,R_OK):
self.log.debug("Destination: " + dst + " is readable")
if os.access(dst,X_OK):
self.log.debug("Destination: " + dst + " is executable")
if os.access(dst,W_OK):
def exists(self, file_name):
"""
Checks for existence of an filesystem object:
1 if exists, 0 if not.
"""
from os import access
from os import F_OK
return access(file_name, F_OK)
src/s/c/scipy-HEAD/scipy/weave/catalog.py scipy(Download)
# Use a cached value for fast return if possible
if hasattr(default_dir,"cached_path") and \
os.path.exists(default_dir.cached_path) and \
os.access(default_dir.cached_path, os.W_OK):
return default_dir.cached_path
python_name = "python%d%d_compiled" % tuple(sys.version_info[:2])
def file_test(x):
from os import access, F_OK, W_OK
return (access(x,F_OK) and access(x,W_OK) or
access(os.path.dirname(x),W_OK))
writable = filter(file_test,files)
if writable:
file = writable[0]
src/p/u/pumat-HEAD/tools/energy.py pumat(Download)
from enthought.traits.api import HasTraits, File, Directory, Property, Float, Array, Int, Instance, Range #Standard library imports from os import access, pathsep, environ, X_OK, W_OK, R_OK, remove from os.path import exists, split, join, abspath from subprocess import Popen, PIPE from sys import stdout
def is_exe(fpath):
return exists(fpath) and access(fpath, X_OK)
fpath, fname = split(program)
if fpath:
if is_exe(program):
return program
else:
def gen_tempfiles(self, suffix_list):
"""Given a list of unique suffixes, generate temporary files with those
suffixes.
"""
#Make sure we have write access to the temporary path
if not access(self.temp_path, W_OK):
raise ValueError, \
src/s/l/Slipy-Tractograhpy-HEAD/weave-local/catalog.py Slipy-Tractograhpy(Download)
# Use a cached value for fast return if possible
if hasattr(default_dir,"cached_path") and \
os.path.exists(default_dir.cached_path) and \
os.access(default_dir.cached_path, os.W_OK):
return default_dir.cached_path
python_name = "python%d%d_compiled" % tuple(sys.version_info[:2])
def file_test(x):
from os import access, F_OK, W_OK
return (access(x,F_OK) and access(x,W_OK) or
access(os.path.dirname(x),W_OK))
writable = filter(file_test,files)
if writable:
file = writable[0]
src/s/a/savonet-HEAD/washtub/wtsite/mediapool/views.py savonet(Download)
from django.utils.encoding import smart_str, smart_unicode
from django.contrib.auth.decorators import login_required
from wtsite.mediapool.models import *
from os import access, stat, path, walk, F_OK, R_OK
from os.path import join, getsize
from stat import ST_MTIME
import tagpy, datetime, logging
def build_file_list(dir):
logging.info('Start of build_file_list(%s)' % dir)
if not (access(dir, (F_OK or R_OK))):
def build_file_list2(dir):
logging.info('Start of build_file_list2(%s)' % dir)
if not (access(dir, (F_OK or R_OK))):
return
#empty all songs from current database. This should be fast!!!
d = Song.objects.all()
d.delete()
def clean_db(dir, songs):
logging.info('Start of clean_db(%s)' % dir)
if not (access(dir, (F_OK or R_OK))):
return
# remove songs that are in the database, but aren't physically on the filesystem
for s in songs:
found = False
def clean_db2(dir, songs):
logging.info('Start of clean_db(%s)' % dir)
if not (access(dir, (F_OK or R_OK))):
return
# No need to remove objects that don't exist (build_file_list2 only adds new to empty database)
# Remove albums that don't have corresponding songs
d = Album.objects.filter(song__title__isnull=True)
src/s/c/scipy-0.8.0/scipy/weave/catalog.py scipy(Download)
# Use a cached value for fast return if possible
if hasattr(default_dir,"cached_path") and \
os.path.exists(default_dir.cached_path) and \
os.access(default_dir.cached_path, os.W_OK):
return default_dir.cached_path
python_name = "python%d%d_compiled" % tuple(sys.version_info[:2])
def file_test(x):
from os import access, F_OK, W_OK
return (access(x,F_OK) and access(x,W_OK) or
access(os.path.dirname(x),W_OK))
writable = filter(file_test,files)
if writable:
file = writable[0]
src/a/s/asciiporn-2009.05.01/asciiporn/weave/catalog.py asciiporn(Download)
def file_test(x):
from os import access, F_OK, W_OK
return (access(x,F_OK) and access(x,W_OK) or
access(os.path.dirname(x),W_OK))
writable = filter(file_test,files)
if writable:
file = writable[0]
1 | 2 | 3 | 4 | 5 Next