Python setuptools.extern.six.moves.builtins.file() Examples

The following are 30 code examples of setuptools.extern.six.moves.builtins.file(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module setuptools.extern.six.moves.builtins , or try the search function .
Example #1
Source File: sandbox.py    From planespotter with MIT License 5 votes vote down vote up
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) 
Example #2
Source File: sandbox.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def __exit__(self, exc_type, exc_value, traceback):
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os) 
Example #3
Source File: sandbox.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
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) 
Example #4
Source File: sandbox.py    From coffeegrindsize with MIT License 5 votes vote down vote up
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) 
Example #5
Source File: sandbox.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #6
Source File: sandbox.py    From coffeegrindsize with MIT License 5 votes vote down vote up
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) 
Example #7
Source File: sandbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #8
Source File: sandbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #9
Source File: sandbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #10
Source File: sandbox.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
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) 
Example #11
Source File: sandbox.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #12
Source File: sandbox.py    From rules_pip with MIT License 5 votes vote down vote up
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) 
Example #13
Source File: sandbox.py    From rules_pip with MIT License 5 votes vote down vote up
def __exit__(self, exc_type, exc_value, traceback):
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os) 
Example #14
Source File: sandbox.py    From rules_pip with MIT License 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #15
Source File: sandbox.py    From planespotter with MIT License 5 votes vote down vote up
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) 
Example #16
Source File: sandbox.py    From rules_pip with MIT License 5 votes vote down vote up
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) 
Example #17
Source File: sandbox.py    From planespotter with MIT License 5 votes vote down vote up
def __exit__(self, exc_type, exc_value, traceback):
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os) 
Example #18
Source File: sandbox.py    From planespotter with MIT License 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #19
Source File: sandbox.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
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) 
Example #20
Source File: sandbox.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
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) 
Example #21
Source File: sandbox.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
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) 
Example #22
Source File: sandbox.py    From stopstalk-deployment with MIT License 5 votes vote down vote up
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) 
Example #23
Source File: sandbox.py    From stopstalk-deployment with MIT License 5 votes vote down vote up
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) 
Example #24
Source File: sandbox.py    From stopstalk-deployment with MIT License 5 votes vote down vote up
def __exit__(self, exc_type, exc_value, traceback):
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os) 
Example #25
Source File: sandbox.py    From stopstalk-deployment with MIT License 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #26
Source File: sandbox.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
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) 
Example #27
Source File: sandbox.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
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) 
Example #28
Source File: sandbox.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def __exit__(self, exc_type, exc_value, traceback):
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os) 
Example #29
Source File: sandbox.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def __enter__(self):
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True 
Example #30
Source File: sandbox.py    From scylla with Apache License 2.0 5 votes vote down vote up
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)