本文整理汇总了Python中topaz.coerce.Coerce.path方法的典型用法代码示例。如果您正苦于以下问题:Python Coerce.path方法的具体用法?Python Coerce.path怎么用?Python Coerce.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类topaz.coerce.Coerce
的用法示例。
在下文中一共展示了Coerce.path方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: singleton_method_delete
# 需要导入模块: from topaz.coerce import Coerce [as 别名]
# 或者: from topaz.coerce.Coerce import path [as 别名]
def singleton_method_delete(self, space, args_w):
for w_path in args_w:
path = Coerce.path(space, w_path)
try:
os.unlink(path)
except OSError as e:
raise error_for_oserror(space, e)
return space.newint(len(args_w))
示例2: singleton_method_chmod
# 需要导入模块: from topaz.coerce import Coerce [as 别名]
# 或者: from topaz.coerce.Coerce import path [as 别名]
def singleton_method_chmod(self, space, mode, args_w):
for arg_w in args_w:
path = Coerce.path(space, arg_w)
try:
os.chmod(path, mode)
except OSError as e:
raise error_for_oserror(space, e)
return space.newint(len(args_w))
示例3: method_sysopen
# 需要导入模块: from topaz.coerce import Coerce [as 别名]
# 或者: from topaz.coerce.Coerce import path [as 别名]
def method_sysopen(self, space, w_path, w_mode_str_or_int=None, w_perm=None):
perm = 0666
mode = os.O_RDONLY
if w_mode_str_or_int is not None:
mode = map_filemode(space, w_mode_str_or_int)
if w_perm is not None and w_perm is not space.w_nil:
perm = space.int_w(w_perm)
path = Coerce.path(space, w_path)
try:
fd = os.open(path, mode, perm)
except OSError as e:
raise error_for_oserror(space, e)
else:
return space.newint(fd)
示例4: find_feature
# 需要导入模块: from topaz.coerce import Coerce [as 别名]
# 或者: from topaz.coerce.Coerce import path [as 别名]
def find_feature(space, path):
assert path is not None
if os.path.isfile(path):
return path
if not path.endswith(".rb"):
path += ".rb"
if not (path.startswith("/") or path.startswith("./") or path.startswith("../")):
w_load_path = space.globals.get(space, "$LOAD_PATH")
for w_base in space.listview(w_load_path):
base = Coerce.path(space, w_base)
full = os.path.join(base, path)
if os.path.isfile(full):
path = os.path.join(base, path)
break
return path
示例5: singleton_method_new
# 需要导入模块: from topaz.coerce import Coerce [as 别名]
# 或者: from topaz.coerce.Coerce import path [as 别名]
def singleton_method_new(self, space, w_name, flags=0):
name = (Coerce.path(space, w_name)
if w_name is not space.w_nil
else None)
lib = W_DynamicLibraryObject(space, name, flags)
return lib