Return a ready-initialized seit-manager object from the CRTomo
        tools. This function only works if the crtomo_tools are installed.
557490
def export_to_crtomo_seit_manager(self, grid):
        
        import crtomo
        g = self.data.groupby('frequency')
        seit_data = {}
        for name, item in g:
            print(name, item.shape, item.size)
            if item.shape[0] > 0:
                seit_data[name] = item[
                    ['a', 'b', 'm', 'n', 'r', 'rpha']
                ].values
        seit = crtomo.eitMan(grid=grid, seit_data=seit_data)
        return seit
966988
def setup(self, tool_id=None, tool_version=None, preserve_galaxy_python_environment=None):
        
        setup_args = {"job_id": self.job_id}
        if tool_id:
            setup_args["tool_id"] = tool_id
        if tool_version:
            setup_args["tool_version"] = tool_version
        if preserve_galaxy_python_environment:
            setup_args["preserve_galaxy_python_environment"] = preserve_galaxy_python_environment
        return self.setup_handler.setup(**setup_args)
460610
def _ready_for_reading(self, timeout=None):
        
        handles = [self._event, self._console_input_reader.handle]
        handles.extend(self._read_fds.keys())
        return _wait_for_handles(handles, timeout)
860454
def apply_crtomo_cfg(self):
        
        for key in sorted(self.tds.keys()):
            self.tds[key].crtomo_cfg = self.crtomo_cfg.copy()
443733
def get_tool_by_name(self, nme):
        
        for t in self.lstTools:
            if 'name' in t:
                if t['name'] == nme:
                    return t
            if 'file' in t:
                if t['file'] == nme:
                    return t
        return None
1289615
def fileprep(self):
        """"""
        # Create and start threads
        for i in range(self.cpus):
            # Send the threads to the appropriate destination function
            threads = Thread(target=self.prep, args=())
            # Set the daemon to true - something to do with thread management
            threads.setDaemon(True)
            # Start the threading
            threads.start()
        for sample in self.metadata:
            # Set the name of the decompressed, combined .fastq file
            sample.general.combined = os.path.join(sample.general.outputdirectory, '{sample_name}_combined.fastq'
                                                   .format(sample_name=sample.name))
            self.queue.put(sample)
        self.queue.join()
1064647
public static synchronized void initialise()
   {
      // Only initialise if it has not already been created
      if (_instance == null)
      {
         // Check what environment we are running in. If we are in server mode we must use the 
         // server diagnostic module.
    	 //Liberty COMMS TODO:
    	 //For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
    	 // without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
    	 // the purpose of COMMS client independence w.r.to COMMS server
    	 //Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
    	
    	 /*
         if (RuntimeInfo.isServer())
         {
            if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
            
            try
            {
               Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
               Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
               _instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
            }
            catch (Exception e)
            {
               FFDCFilter.processException(e, CLASS_NAME + ".initialise", 
                                           CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
                                           CommsConstants.SERVER_DIAG_MODULE_CLASS);
               
               if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
               
               // In this case, fall out of here with a null _instance and default to the client
               // one. At least in that case we get _some_ diagnostics...
               // This is the point where I mention that that shouldn't ever happen :-).
            }
         }
         */

         // In all other cases use the client diagnostic module. Note we can instantiate this
         // directly as we are located in the same build component
         if (_instance == null)
         {
            if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
            
            _instance = ClientCommsDiagnosticModule.getInstance();
         }
         
         // Now register the packages
         _instance.register(packageList);
      }
   }
1154204
def get_tool(name, context=None, default=_marker):
    

    # Try first with the context
    if context is not None:
        try:
            context = get_object(context)
            return getToolByName(context, name)
        except (APIError, AttributeError) as e:
            # https://github.com/senaite/bika.lims/issues/396
            logger.warn("get_tool::getToolByName({}, '{}') failed: {} "
                        "-> falling back to plone.api.portal.get_tool('{}')"
                        .format(repr(context), name, repr(e), name))
            return get_tool(name, default=default)

    # Try with the plone api
    try:
        return ploneapi.portal.get_tool(name)
    except InvalidParameterError:
        if default is not _marker:
            return default
        fail("No tool named '%s' found." % name)
921292
public static Manager getManager(ServletContext servletContext) {
		Object managerObject = servletContext.getAttribute(SimonUtils.MANAGER_SERVLET_CTX_ATTRIBUTE);
		Manager manager = null;
		if (managerObject instanceof Manager) {
			manager =(Manager) managerObject;
		}
		return manager;
	}
242200
private Management getProxyChain(Management m)
            throws ModuleInitializationException {
        try {
            invocationHandlers = getInvocationHandlers();
            return (Management) ProxyFactory.getProxy(m, invocationHandlers);
        } catch (Exception e) {
            throw new ModuleInitializationException(e.getMessage(), getRole());
        }
    }
678372
def get_tools(whitelist, known_plugins):
    
    def getpath(c):
        return "%s:%s" % (c.__module__, c.__class__.__name__)

    tools = [x for x in known_plugins if getpath(x) in whitelist]

    if not tools:
        if whitelist:
            raise UnknownTools(map(getpath, known_plugins))
        tools = known_plugins
    return tools
278437
def get_monitor(host=PINBA_SERVER, port=PINBA_PORT, *args, **kwargs):
    
    kwargs['servername'] = PINBA_SERVER_NAME
    kwargs['scriptname'] = __file__

    for item in inspect.stack():
        if item and __file__ not in item:
            kwargs['scriptname'] = item[3]
            break

    return ScriptMonitor((host, port), *args, **kwargs)
552552
def selfcheck(tools):
    
    msg = []
    for tool_name, check_cli in collections.OrderedDict(tools).items():
        try:
            subprocess.check_output(check_cli, shell=True, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError:
            msg.append('%r not found or not usable.' % tool_name)
    return '\n'.join(msg) if msg else 'Your system is ready.'
13435
def as_manager(cls, obj):
        
        if isinstance(obj, cls): return obj
        if obj is None: return cls.from_user_config()

        if is_string(obj):
            if os.path.exists(obj):
                return cls.from_file(obj)
            else:
                return cls.from_string(obj)

        elif isinstance(obj, collections.abc.Mapping):
            return cls.from_dict(obj)
        else:
            raise TypeError("Don't know how to convert type %s to TaskManager" % type(obj))
1178855
def manager(self):
        
        manager = SMCRequest._session_manager if not self._manager \
            else self._manager
        if not manager:
            raise SessionManagerNotFound('A session manager was not found. '
                'This is an initialization error binding the SessionManager. ')
        return manager
67164
private static SeLionSoftAssert getSoftAssertInContext() {
        SeLionSoftAssert sa;
        if (null == Reporter.getCurrentTestResult()) {
            // Assume Java Application, and return the static instance of SeLionSoftAssert.
            sa = softAssert;
        }
        else {
            sa = (SeLionSoftAssert) Reporter.getCurrentTestResult().getAttribute(
                SeLionSoftAssert.SOFT_ASSERT_ATTRIBUTE_NAME);
        }
        return sa;
    }
1258578
def tool_options_from_global(global_options, num_jobs):
    """"""
    internal_opt = ["whitelist", "blacklist", "fix_what_you_can"]
    queue_object = _obtain_queue(num_jobs)
    translate = defaultdict(lambda: (lambda x: x),
                            log_technical_terms_to=lambda _: queue_object)

    tool_options = OrderedDict()

    for key in sorted(global_options.keys()):
        if key not in internal_opt and global_options[key] is not None:
            tool_options[key] = translate[key](global_options[key])

    return tool_options