|
| 1 | +# Copyright (c) 2018, Oracle and/or its affiliates. |
| 2 | +# |
| 3 | +# The Universal Permissive License (UPL), Version 1.0 |
| 4 | +# |
| 5 | +# Subject to the condition set forth below, permission is hereby granted to any |
| 6 | +# person obtaining a copy of this software, associated documentation and/or data |
| 7 | +# (collectively the "Software"), free of charge and under any and all copyright |
| 8 | +# rights in the Software, and any and all patent rights owned or freely |
| 9 | +# licensable by each licensor hereunder covering either (i) the unmodified |
| 10 | +# Software as contributed to or provided by such licensor, or (ii) the Larger |
| 11 | +# Works (as defined below), to deal in both |
| 12 | +# |
| 13 | +# (a) the Software, and |
| 14 | +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if |
| 15 | +# one is included with the Software (each a "Larger Work" to which the |
| 16 | +# Software is contributed by such licensors), |
| 17 | +# |
| 18 | +# without restriction, including without limitation the rights to copy, create |
| 19 | +# derivative works of, display, perform, and distribute the Software and make, |
| 20 | +# use, sell, offer for sale, import, export, have made, and have sold the |
| 21 | +# Software and the Larger Work(s), and to sublicense the foregoing rights on |
| 22 | +# either these or other terms. |
| 23 | +# |
| 24 | +# This license is subject to the following condition: |
| 25 | +# |
| 26 | +# The above copyright notice and either this complete permission notice or at a |
| 27 | +# minimum a reference to the UPL must be included in all copies or substantial |
| 28 | +# portions of the Software. |
| 29 | +# |
| 30 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 31 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 32 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 33 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 34 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 35 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 36 | +# SOFTWARE. |
| 37 | + |
| 38 | +import sys |
| 39 | +import builtins |
| 40 | + |
| 41 | +# ---------------------------------------------------------------------------------------------------------------------- |
| 42 | +# |
| 43 | +# patch _io |
| 44 | +# |
| 45 | +# ---------------------------------------------------------------------------------------------------------------------- |
| 46 | + |
| 47 | +import _io |
| 48 | +import _pyio |
| 49 | +import io |
| 50 | + |
| 51 | +for module in [_io, io]: |
| 52 | + setattr(module, 'open', _pyio.open) |
| 53 | + setattr(module, 'TextIOWrapper', _pyio.TextIOWrapper) |
| 54 | + setattr(module, 'IncrementalNewlineDecoder', _pyio.IncrementalNewlineDecoder) |
| 55 | + setattr(module, 'BufferedRandom', _pyio.BufferedRandom) |
| 56 | + setattr(module, 'BufferedRWPair', _pyio.BufferedRWPair) |
| 57 | + setattr(module, 'BufferedWriter', _pyio.BufferedWriter) |
| 58 | + setattr(module, 'BufferedReader', _pyio.BufferedReader) |
| 59 | + setattr(module, 'StringIO', _pyio.StringIO) |
| 60 | + setattr(module, '_IOBase', _pyio.IOBase) |
| 61 | + setattr(module, 'RawIOBase', _pyio.RawIOBase) |
| 62 | + setattr(module, 'BytesIO', _pyio.BytesIO) |
| 63 | + setattr(module, '_TextIOBase', _pyio.TextIOBase) |
| 64 | + |
| 65 | +setattr(builtins, 'open', _pyio.open) |
| 66 | +globals()['open'] = _pyio.open |
0 commit comments