How to use the traits.api.cached_property function in traits

To help you get started, we’ve selected a few traits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github capn-freako / PyBERT / pybert / pybert.py View on Github external
    @cached_property
    def _get_f(self):
        """
        Calculate the frequency vector appropriate for indexing non-shifted FFT output, in Hz.
        # (i.e. - [0, f0, 2 * f0, ... , fN] + [-(fN - f0), -(fN - 2 * f0), ... , -f0]
        """

        t = self.t

        npts = len(t)
        f0 = 1.0 / (t[1] * npts)
        half_npts = npts // 2

        return array([i * f0 for i in range(half_npts + 1)] + [(half_npts - i) * -f0 for i in range(1, half_npts)])
github mne-tools / mne-python / mne / gui / _coreg_gui.py View on Github external
    @cached_property
    def _get_rotation(self):
        rot = np.array([self.rot_x, self.rot_y, self.rot_z])
        return rot
github mne-tools / mne-python / mne / gui / _fiducials_gui.py View on Github external
    @cached_property
    def _get_can_save_as(self):
        can = not (np.all(self.nasion == self.lpa) or
                   np.all(self.nasion == self.rpa) or
                   np.all(self.lpa == self.rpa))
        return can
github mne-tools / mne-python / mne / gui / _kit2fiff_gui.py View on Github external
    @cached_property
    def _get_queue_len_str(self):
        if self.queue_len:
            return "Queue length: %i" % self.queue_len
        else:
            return ''
github jaidevd / pysemantic / pysemantic / validator.py View on Github external
    @cached_property
    def _get_postprocessors(self):
        return self.rules.get("postprocessors", [])
github enthought / traitsui / traitsui / extras / tutor.py View on Github external
    @cached_property
    def _get_visible_snippets(self):
        """ Returns the list of code items that are currently visible.
        """
        if self.visible:
            return self.snippets

        return [snippet for snippet in self.snippets if (not snippet.hidden)]
github mne-tools / mne-python / mne / gui / _coreg_gui.py View on Github external
    @cached_property
    def _get_mri_trans(self):
        t = self.mri_trans_noscale.copy()
        t[:, :3] *= self.parameters[6:9]
        return t
github bpteague / cytoflow / cytoflowgui / vertical_notebook.py View on Github external
    @cached_property
    def _get_control(self):
        """ 
        Returns the control cluster for the notebook page
        """
        self.layout = QtGui.QVBoxLayout()
        control = QtGui.QWidget()

        buttons_layout = QtGui.QHBoxLayout()
        buttons_container = QtGui.QWidget()
        
        self.cmd_button = QtGui.QCommandLinkButton(buttons_container)
        self.cmd_button.setVisible(True)
        self.cmd_button.setCheckable(True)
        self.cmd_button.setFlat(True)
        self.cmd_button.setAutoFillBackground(True)
        self.cmd_button.clicked.connect(self._handle_page_toggle)
github acoular / acoular / acoular / microphones.py View on Github external
    @cached_property
    def _get_digest( self ):
        return digest(self)
github mne-tools / mne-python / mne / gui / _coreg_gui.py View on Github external
    @cached_property
    def _get_transformed_hsp_lpa(self):
        return apply_trans(self.hsp_trans, self.hsp.lpa)