Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

            def compat_open(filename, mode='r', encoding=None):
        # See docstring for compat_open in the PY3 section above.
        if 'b' not in mode:
            encoding = locale.getpreferredencoding()
        return io.open(filename, mode, encoding=encoding)
        


src/a/w/aws-cli-HEAD/awscli/paramfile.py   aws-cli(Download)
import six
 
from awscli.compat import compat_open
 
 
        raise ResourceLoadingError("file does not exist: %s" % file_path)
    try:
        with compat_open(file_path, 'r') as f:
            return f.read()
    except (OSError, IOError) as e:

src/a/w/aws-cli-HEAD/tests/unit/ec2/test_run_instances.py   aws-cli(Download)
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from awscli.compat import compat_open
 
from tests import temporary_file
    def test_user_data(self):
        data = u'\u0039'
        with temporary_file('r+') as tmp:
            with compat_open(tmp.name, 'w') as f:
                f.write(data)