d33c107d22daa4ae7ee88e6fe32e7ed8cf11273f,mathics/builtin/importexport.py,Import,apply,#Import#Any#Any#Any#,415

Before Change


        // Download via URL
        if isinstance(filename, String):
            url = filename.get_string_value()
            if any(url.startswith(prefix) for prefix in ("http://", "https://", "ftp://")):
                import tempfile
                import os
                temp_handle, temp_path = tempfile.mkstemp(suffix="")
                try:
                    with urllib2.urlopen(url) as f:
                        content_type = f.info().get_content_type()
                        os.write(temp_handle, f.read())

                    def determine_filetype():
                        return mimetype_dict.get(content_type)

                    result = self._import(temp_path, determine_filetype, elements, evaluation)
                finally:
                    os.unlink(temp_path)

                return result

        // Load local file
        findfile = Expression("FindFile", filename).evaluate(evaluation)
        if findfile == Symbol("$Failed"):
            evaluation.message("Import", "nffil")
            return findfile

After Change


        // Download via URL
        if isinstance(filename, String):
            if any(filename.get_string_value().startswith(prefix) for prefix in ("http://", "https://", "ftp://")):
                return Expression("FetchURL", filename, elements)

        // Load local file
        findfile = Expression("FindFile", filename).evaluate(evaluation)
        if findfile == Symbol("$Failed"):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: mathics/Mathics
Commit Name: d33c107d22daa4ae7ee88e6fe32e7ed8cf11273f
Time: 2016-09-14
Author: Bernhard.Liebl@gmx.org
File Name: mathics/builtin/importexport.py
Class Name: Import
Method Name: apply


Project Name: mathics/Mathics
Commit Name: 5a8afe8256c9586a9dff05e4c16b69d53f5857ae
Time: 2016-08-08
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/inout.py
Class Name: Off
Method Name: apply


Project Name: mathics/Mathics
Commit Name: 5a8afe8256c9586a9dff05e4c16b69d53f5857ae
Time: 2016-08-08
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/inout.py
Class Name: On
Method Name: apply