Convert to Analysis Service

        :param thing: UID/Catalog Brain/Object/Something
        :returns: Analysis Service object or None
497337
def _to_service(self, thing):
        

        # Convert UIDs to objects
        if api.is_uid(thing):
            thing = api.get_object_by_uid(thing, None)

        # Bail out if the thing is not a valid object
        if not api.is_object(thing):
            logger.warn("'{}' is not a valid object!".format(repr(thing)))
            return None

        # Ensure we have an object here and not a brain
        obj = api.get_object(thing)

        if IAnalysisService.providedBy(obj):
            return obj

        if IAnalysis.providedBy(obj):
            return obj.getAnalysisService()

        # An object, but neither an Analysis nor AnalysisService?
        # This should never happen.
        portal_type = api.get_portal_type(obj)
        logger.error("ARAnalysesField doesn't accept objects from {} type. "
                     "The object will be dismissed.".format(portal_type))
        return None
954118
def analyze(obj, command, args, &block)
      @global_options, @command, @original_args = {}, command, args.dup
      @args = translate_args(obj, args)
      return run_help_option(@command) if @global_options[:help]
      during_analyze(&block)
    rescue OptionParser::Error, Error
      raise if Boson.in_shell
      warn "Error: #{$!}"
    end
145930
def get_analyses_at(self, slot):
        

        # ensure we have an integer
        slot = to_int(slot)

        if slot < 1:
            return list()

        analyses = list()
        layout = self.getLayout()

        for pos in layout:
            layout_slot = to_int(pos['position'])
            uid = pos['analysis_uid']
            if layout_slot != slot or not uid:
                continue
            analyses.append(api.get_object_by_uid(uid))

        return analyses
1118588
def _iter_convert_to_object(self, iterable):
        """"""
        for binsha, mode, name in iterable:
            path = join_path(self.path, name)
            try:
                yield self._map_id_to_type[mode >> 12](self.repo, binsha, mode, path)
            except KeyError:
                raise TypeError("Unknown mode %o found in tree data for path '%s'" % (mode, path))
240507
def get_service(self, uuid):
        
        if uuid in self.services:
            return self.services[uuid]

        if pp_hex(uuid) in self.services:
            return self.services[pp_hex(uuid)]

        return None
1220937
def getReferenceAnalysesService(self, service_uid):
        
        analyses = []
        for analysis in self.objectValues('ReferenceAnalysis'):
            if analysis.getServiceUID() == service_uid:
                analyses.append(analysis)
        return analyses
112024
def analyze(self, args):
        
        self.log.info("Running catalog analysis")

        if args.count:
            self.count()

        return
386250
def get_analysis_type(self, instance):
        
        if IDuplicateAnalysis.providedBy(instance):
            return 'd'
        elif IReferenceAnalysis.providedBy(instance):
            return instance.getReferenceType()
        elif IRoutineAnalysis.providedBy(instance):
            return 'a'
        return None
1367315
def getWorksheetServices(self):
        
        services = []
        for analysis in self.getAnalyses():
            service = analysis.getAnalysisService()
            if service and service not in services:
                services.append(service)
        return services
346920
def get_catalog_for(self, brain_or_object):
        
        if not api.is_object(brain_or_object):
            raise TypeError("Invalid object type %r" % brain_or_object)
        catalogs = api.get_catalogs_for(brain_or_object, default="uid_catalog")
        return catalogs[0]
865076
function getPutOperation(name, thing) {
  if (typeof thing === 'object') {
    thing = JSON.stringify(thing);
  }

  return { type: 'put', key: name, value: thing };
}
204245
def Services(self, field, show_select_column=True):
        

        instance = getattr(self, "instance", field.aq_parent)
        table = api.get_view("table_analyses_services",
                             context=instance,
                             request=self.REQUEST)
        # Call listing hooks
        table.update()
        table.before_render()
        return table.ajax_contents_table()
695905
function convertToObject(spectra) {
    var result={};
    for (var i=0; i<spectra.length; i++) {
        var spectrum=spectra[i];
        result[spectrum.type]=spectrum;
    }
    return result;
}
249444
def from_analysis_period(cls, analysis_period=None):
        
        if not analysis_period:
            return cls()
        elif hasattr(analysis_period, 'isAnalysisPeriod'):
            return analysis_period
        elif isinstance(analysis_period, str):
            try:
                return cls.from_string(analysis_period)
            except Exception as e:
                raise ValueError(
                    "{} is not convertable to an AnalysisPeriod: {}".format(
                        analysis_period, e)
                )
554852
def analysisJWT(self, token):
        
        _header, _payload, _signature = token.split(".")
        data = {
            "header": json.loads(base64.urlsafe_b64decode(str(_header))),
            "payload": json.loads(base64.urlsafe_b64decode(str(_payload))),
            "signature": base64.urlsafe_b64decode(str(_signature))
        }
        logging.debug("analysis token: {0}".format(data))
        return data
92599
def get(cls, **kwargs):
        
        things = cls.filter(**kwargs)
        if len(things) > 1:
            # Raise an exception if more than one object is matched
            raise cls.MultipleObjectsReturned
        elif len(things) == 0:
            # Rase an exception if no objects were matched
            raise cls.DoesNotExist
        return things[0]
627139
def get_object(self, brain_or_object_or_uid):
        
        if api.is_uid(brain_or_object_or_uid):
            return api.get_object_by_uid(brain_or_object_or_uid, default=None)
        if api.is_object(brain_or_object_or_uid):
            return api.get_object(brain_or_object_or_uid)
        return None