98100abde55f1fb0ab455f95b9259c3adcdbab2c,PyInstaller/building/imphook.py,ImportHook,_process_excludedimports,#ImportHook#Any#,267

Before Change


                    //       are not reachable from the top-level script. But import hoosks
                    //       for modules in dead branches will get processed!
                    // TODO Find out a way to remove unreachable branches in the graph. - Create a new graph object that will be constructed just from the top-level script?
                    if safe_to_remove:
                        submodule_list = set()
                        // First find submodules.
                        for subnode in mod_graph.nodes():
                            if subnode.identifier.startswith(excluded_node.identifier + "."):
                                submodule_list.add(subnode)
                        // Then remove references to those submodules.
                        for mod in submodule_list:
                            mod_referers = mod_graph.getReferers(mod)
                            for mod_ref in mod_referers:
                                mod_graph.removeReference(mod_ref, mod)
                            logger.warn("  Removing import "%s"" % mod.identifier)
                            mod_graph.removeNode(mod)
                        // Remove the parent node itself.
                        logger.warn("  Removing import "%s"" % item)
                        mod_graph.removeNode(excluded_node)

                else:
                    logger.info("Excluded import "%s" not found" % item)
            except ImportError:
                // excludedimport could not be found.

After Change


        for item in not_allowed_references:
            excluded_node = mod_graph.findNode(item, create_nspkg=False)
            if excluded_node is None:
                logger.info("Import to be excluded not found: %r", item)
                continue
            logger.info("Excluding import %r", item)
            targets_to_remove.extend(find_all_package_nodes(item))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pyinstaller/pyinstaller
Commit Name: 98100abde55f1fb0ab455f95b9259c3adcdbab2c
Time: 2015-10-19
Author: h.goebel@crazy-compilers.com
File Name: PyInstaller/building/imphook.py
Class Name: ImportHook
Method Name: _process_excludedimports


Project Name: Qiskit/qiskit-aqua
Commit Name: f361f196706b37a067069aae271997a3a6218d06
Time: 2019-08-26
Author: chenrich@us.ibm.com
File Name: qiskit/aqua/algorithms/many_sample/eoh/eoh.py
Class Name: EOH
Method Name: __init__


Project Name: mne-tools/mne-python
Commit Name: 2dd49058dba6cf1527e2414221d4b08b127f96d5
Time: 2019-04-24
Author: larson.eric.d@gmail.com
File Name: mne/forward/forward.py
Class Name:
Method Name: _restrict_gain_matrix