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

Before Change


        if elements.has_form("List", None):
            elements = elements.get_leaves()
        else:
            elements = [elements]

        for el in elements:
            if not isinstance(el, String):
                evaluation.message("Import", "noelem", el)
                return Symbol("$Failed")

        elements = [el.get_string_value() for el in elements]

        // Determine file type
        for el in elements:
            if el in IMPORTERS.keys():
                filetype = el
                elements.remove(el)
                break
        else:
            filetype = Expression("FileFormat", findfile).evaluate(
                evaluation=evaluation).get_string_value()

        return self._import(findfile, filetype, elements, evaluation)

    def _import(self, findfile, filetype, elements, evaluation):
        if filetype not in IMPORTERS.keys():

After 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="")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


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


Project Name: pgmpy/pgmpy
Commit Name: 04c38b9bec12600f98cf8cb8f366b89885fb43f6
Time: 2014-01-01
Author: ankurankan@gmail.com
File Name: src/BayesianModel/BayesianModel.py
Class Name: BayesianModel
Method Name: _update_node_observed_status


Project Name: andresriancho/w3af
Commit Name: 25cbfe064306473f81efc9c575d164d23e365422
Time: 2018-04-13
Author: self@andresriancho.com
File Name: w3af/plugins/tests/crawl/test_robots_txt.py
Class Name: TestRobots
Method Name: test_robots