def run_code(self, code_str,
                 use_input=False,
                 use_output=False):
        """run_code runs a piece of code as a VisTrails module.
        use_input and use_output control whether to use the inputport
        and output port dictionary as local variables inside the
        execution."""
        import vistrails.core.packagemanager
        def fail(msg):
            raise ModuleError(self, msg)
        def cache_this():
            self.is_cacheable = lambda *args, **kwargs: True
        locals_ = locals()
        if use_input:
            for k in self.inputPorts:
                locals_[k] = self.get_input(k)
        if use_output:
            for output_portname in self.output_ports_order:
                if self.inputPorts not in output_portname:
                    locals_[output_portname] = None
        _m = vistrails.core.packagemanager.get_package_manager()
        reg = get_module_registry()
        locals_.update({'fail': fail,
                        'package_manager': _m,
                        'cache_this': cache_this,
                        'registry': reg,
                        'self': self})
        if 'source' in locals_:
            del locals_['source']
        # Python 2.6 needs code to end with newline
        exec code_str + '\n' in locals_, locals_
        if use_output:
            for k in self.output_ports_order:
                if locals_.get(k) is not None:
                    self.set_output(k, locals_[k])

##############################################################################
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/basic_modules.py/CodeRunnerMixin.run_code/swapped operands of `not in`