本文整理匯總了Python中setuptools.extern.six.moves.builtins.file方法的典型用法代碼示例。如果您正苦於以下問題:Python builtins.file方法的具體用法?Python builtins.file怎麽用?Python builtins.file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類setuptools.extern.six.moves.builtins
的用法示例。
在下文中一共展示了builtins.file方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def run(self, func):
"""Run 'func' under os sandboxing"""
try:
self._copy(self)
if _file:
builtins.file = self._file
builtins.open = self._open
self._active = True
return func()
finally:
self._active = False
if _file:
builtins.file = _file
builtins.open = _open
self._copy(_os)
示例2: _file
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def _file(self, path, mode='r', *args, **kw):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
self._violation("file", path, mode, *args, **kw)
return _file(path,mode,*args,**kw)
示例3: open
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def open(self, file, flags, mode=0o777, *args, **kw):
"""Called for low-level os.open()"""
if flags & WRITE_FLAGS and not self._ok(file):
self._violation("os.open", file, flags, mode, *args, **kw)
return _os.open(file,flags,mode, *args, **kw)
示例4: _file
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def _file(self, path, mode='r', *args, **kw):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
self._violation("file", path, mode, *args, **kw)
return _file(path, mode, *args, **kw)
示例5: open
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def open(self, file, flags, mode=0o777, *args, **kw):
"""Called for low-level os.open()"""
if flags & WRITE_FLAGS and not self._ok(file):
self._violation("os.open", file, flags, mode, *args, **kw)
return _os.open(file, flags, mode, *args, **kw)
示例6: __enter__
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def __enter__(self):
self._copy(self)
if _file:
builtins.file = self._file
builtins.open = self._open
self._active = True
示例7: __exit__
# 需要導入模塊: from setuptools.extern.six.moves import builtins [as 別名]
# 或者: from setuptools.extern.six.moves.builtins import file [as 別名]
def __exit__(self, exc_type, exc_value, traceback):
self._active = False
if _file:
builtins.file = _file
builtins.open = _open
self._copy(_os)