Get reference cycle details.
771315
def garbage_cycle(index):
    """"""
    graph = _compute_garbage_graphs()[int(index)]
    graph.reduce_to_cycles()
    objects = graph.metadata
    objects.sort(key=lambda x: -x.size)
    return dict(objects=objects, index=index)
1303829
def _process_refs(x, labels):
    """"""

    # Scan the element list x for Cite elements with known labels
    for i, v in enumerate(x):
        if v['t'] == 'Cite' and len(v['c']) == 2 and \
          _get_label(v['t'], v['c']) in labels:

            # A new reference was found; create some empty attributes for it
            attrs = ['', [], []]

            # Extract the modifiers.  'attrs' is updated in place.  Element
            # deletion could change the index of the Cite being processed.
            if i > 0:
                i = _extract_modifier(x, i, attrs)

            # Attach the attributes
            v['c'].insert(0, attrs)

            # Remove surrounding brackets
            if i > 0 and i < len(x)-1:
                _remove_brackets(x, i)

            # The element list may be changed
            return None  # Forces processing to repeat via _repeat decorator

    return True
349169
def get_param(self):
        
        cycle_progress = self.event_index / self.cycle_size
        return self.start_value + ((self.end_value - self.start_value) / 2) * (1 - math.cos(math.pi * cycle_progress))
545848
def get_ref(self):
        
        if self.ref_key == 'NETWORK':
            return self.network
        elif self.ref_key == 'NODE':
            return self.node
        elif self.ref_key == 'LINK':
            return self.link
        elif self.ref_key == 'GROUP':
            return self.group
        elif self.ref_key == 'SCENARIO':
            return self.scenario
        elif self.ref_key == 'PROJECT':
            return self.project
234422
def get(self, instance, aslist=False, **kwargs):
        
        refs = self.get_versioned_references_for(instance)

        if not self.multiValued:
            if len(refs) > 1:
                logger.warning("Found {} references for non-multivalued "
                               "reference field '{}' of {}".format(
                                   len(refs), self.getName(), repr(instance)))
            if not aslist:
                if refs:
                    refs = refs[0]
                else:
                    refs = None

        if not self.referencesSortable or not hasattr(
                aq_base(instance), "at_ordered_refs"):
            return refs

        refs = instance.at_ordered_refs
        order = refs[self.relationship]
        if order is None:
            return refs

        by_uid = dict(map(lambda ob: (api.get_uid(ob), ob), refs))
        return [by_uid[uid] for uid in order if uid in by_uid]
1099078
def update_cycles(self):
        """"""
        self.idx_cycle.clear()

        try:
            self.cycles = self.parent.notes.annot.get_cycles()

        except ValueError as err:
            self.idx_cycle.setEnabled(False)
            msg = 'There is a problem with the cycle markers: ' + str(err)
            self.parent.statusBar().showMessage(msg)

        else:
            if self.cycles is None:
                self.idx_cycle.setEnabled(False)
            else:
                self.idx_cycle.setEnabled(True)
                for i in range(len(self.cycles)):
                    self.idx_cycle.addItem(str(i+1))
36259
def duty_cycle(self):
        """"""
        pwm = self._pca.pwm_regs[self._index]
        if pwm[0] == 0x1000:
            return 0xffff
        return pwm[1] << 4
1055095
def References(self):
        
        if self.__references is None:

            refs = {}

            # group by the input prevhash
            for hash, group in groupby(self.inputs, lambda x: x.PrevHash):

                tx, height = GetBlockchain().GetTransaction(hash.ToBytes())
                if tx is not None:
                    for input in group:
                        refs[input] = tx.outputs[input.PrevIndex]

            self.__references = refs

        return self.__references
944998
def reference_journal(self, index):
        """"""
        # TODO Change the column name 'Journal' to an other?
        ref_type = self.reference_type(index)
        if ref_type == "journalArticle":
            return self.reference_data(index)["publicationTitle"]
        else:
            return "({})".format(ref_type)
1372459
def ref_coords(self):
        ''''''
        return pyfastaq.intervals.Interval(min(self.ref_start, self.ref_end), max(self.ref_start, self.ref_end))
1108888
def _get_ref_lengths(self):
        ''''''
        sam_reader = pysam.Samfile(self.bam, "rb")
        return dict(zip(sam_reader.references, sam_reader.lengths))
659129
def get_cycles(self):
        '''
        '''
        logger.info('get cycles of experiment "%s"', self.experiment_name)
        url = self._build_api_url(
            '/experiments/{experiment_id}/cycles'.format(
                experiment_id=self._experiment_id
            )
        )
        res = self._session.get(url)
        res.raise_for_status()
        return res.json()['data']
928589
private static Integer[] getAdjustedCycle(int cycleNumber) {
        Integer[] cycles;
        try {
            cycles = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(cycleNumber));
        } catch (ArrayIndexOutOfBoundsException e) {
            cycles = null;
        }
        if (cycles == null) {
            cycles = DEFAULT_CYCLE_YEARS;
        }
        return cycles;
    }
421204
def _references(self, i, sequence=False):
        """"""

        value = ''
        c = next(i)
        if c == '\\':
            # \\
            if sequence and self.bslash_abort:
                raise PathNameException
            value = r'\\'
            if self.bslash_abort:
                if not self.in_list:
                    value = self.get_path_sep() + _ONE_OR_MORE
                    self.set_start_dir()
                else:
                    value = self._restrict_extended_slash() + value
        elif c == '/':
            # \/
            if sequence and self.pathname:
                raise PathNameException
            if self.pathname:
                value = r'\\'
                if self.in_list:
                    value = self._restrict_extended_slash() + value
                i.rewind(1)
            else:
                value = re.escape(c)
        else:
            # \a, \b, \c, etc.
            value = re.escape(c)
            if c == '.' and self.after_start and self.in_list:
                self.allow_special_dir = True
                self.reset_dir_track()

        return value
92477
def refs(self):
        """"""

        def set_bundle(s):
            s._bundle = self
            return s

        return list(set_bundle(s) for s in self.dataset.sources if not s.is_downloadable)
40075
def get_reference(self, refobj):
        
        c = cmds.listConnections("%s.referencenode" % refobj, d=False)
        return c[0] if c else None
674332
def _read_reference_information(self):
    """"""
    ref_lengths = {}
    ref_names = []
    for n in range(self._n_ref):
      l_name = struct.unpack('<i',self._fh.read(4))[0]
      name = self._fh.read(l_name).rstrip('\0')
      l_ref = struct.unpack('<i',self._fh.read(4))[0]
      ref_lengths[name] = l_ref
      ref_names.append(name)
    return ref_lengths, ref_names