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

Before Change


                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"):

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: 6

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: af4b29bd5694e2eec570d67602c4a81b5364b34d
Time: 2020-09-05
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply


Project Name: mathics/Mathics
Commit Name: deed936ca0bfa5998af0225fab99c47bd2bc4b6d
Time: 2020-09-06
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply