015f0b12ab899d3c5ad19d75f1b8d25e8296faca,pysos/kernel.py,SoS_Kernel,handle_magic_cd,#SoS_Kernel#Any#,881

Before Change



    def handle_magic_cd(self, option):
        // interpolate command
        try:
            new_option = interpolate(option, sigil="${ }", local_dict=env.sos_dict._dict)
            if new_option != option:
                option = new_option
                if not option.startswith("cd ") and not option.startswith("cd\t"):
                    self.send_response(self.iopub_socket, "stream",
                        {"name": "stdout", "text":
                        new_option.strip() + "\n//// -- End interpolated command --\n"})
        except Exception as e:
            self.send_response(self.iopub_socket, "stream",
                {"name": "stdout", "text": "Failed to interpolate {}: {}\n".format(short_repr(option), e)})
            self.send_response(self.iopub_socket, "stream",
                {"name": "stdout", "text": str(e)})
            return
        to_dir = option.strip()
        try:
            os.chdir(os.path.expanduser(to_dir))
            self.send_response(self.iopub_socket, "stream",

After Change


                self.send_response(self.iopub_socket, "stream",
                    {"name": "stderr", "text": "\n> Failed to find file or evaluate expression {}: {}".format(item, e)})

    def handle_magic_cd(self, option):
        // interpolate command
        option = self._interpolate_option(option, quiet=True)
        if option is None:
            return
        to_dir = option.strip()
        try:
            os.chdir(os.path.expanduser(to_dir))
            self.send_response(self.iopub_socket, "stream",
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 23

Instances


Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_magic_cd


Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: _do_execute


Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_shell_command


Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_magic_cd