Return a cut version of this |Subsystem|.

        Args:
            cut (Cut): The cut to apply to this |Subsystem|.

        Returns:
            Subsystem: The cut subsystem.
484070
def apply_cut(self, cut):
        
        return Subsystem(self.network, self.state, self.node_indices,
                         cut=cut, mice_cache=self._mice_cache)
726190
def ms_cutall(self, viewer, event, data_x, data_y):
        
        if not self.cancut:
            return True

        x, y = self.get_win_xy(viewer)

        if event.state == 'move':
            self._cutboth_xy(viewer, x, y)

        elif event.state == 'down':
            self._start_x, self._start_y = x, y
            image = viewer.get_image()
            #self._loval, self._hival = viewer.get_cut_levels()
            self._loval, self._hival = viewer.autocuts.calc_cut_levels(image)

        else:
            viewer.onscreen_message(None)
        return True
624920
def cut(list_, index=0):
    """"""
    if isinstance(index, int):
        cut_ = lambda x: x[index]
    else:
        cut_ = lambda x: getattr(x, index)
    return list(map(cut_, list_))
591513
def sub(self, *segments):
        ""
        d = self
        for segment in segments:
            try:
                d = d[segment]
            except KeyError:
                return ConfigDict({})
        return d
150099
def remove_subsegment(self, subsegment):
        
        super(Subsegment, self).remove_subsegment(subsegment)
        self.parent_segment.decrement_subsegments_size()
981341
def slices(self):
        

        return (slice(self.origin[1], self.origin[1] + self.shape[1]),
                slice(self.origin[0], self.origin[0] + self.shape[0]))
1230153
def depth_slice(self):
        

        if self.depth is not None:
            return self.depth

        from .depth import Depth
        self.depth = Depth(self)
        return self.depth
439652
def remove_sub(self, sub):
        
        for _sid in self.get('sub2sid', sub):
            self.remove('sid2sub', _sid, sub)
        self.delete('sub2sid', sub)
1208369
def trace_xray_subsegment(skip_args=False):
    
    @wrapt.decorator
    def wrapper(wrapped, instance, args, kwargs):
        metadata_extractor = (
            noop_function_metadata
            if skip_args
            else extract_function_metadata
        )
        return generic_xray_wrapper(
            wrapped, instance, args, kwargs,
            name=get_function_name,
            namespace='local',
            metadata_extractor=metadata_extractor,
        )

    return wrapper
23175
def slice_to(self, s):
        '''
        
        '''
        result = ''
        if self.slice_check():
            result = self.current[self.bra:self.ket]
        return result
803088
def put_subsegment(self, subsegment):
        
        entity = self.get_trace_entity()
        if not entity:
            log.warning("Active segment or subsegment not found. Discarded %s." % subsegment.name)
            return

        entity.add_subsegment(subsegment)
        self._local.entities.append(subsegment)
683105
def _slicespec2boundsspec(slicespec,scs):
        
        r1,r2,c1,c2 = slicespec

        left,bottom = scs.matrix2sheet(r2,c1)
        right, top  = scs.matrix2sheet(r1,c2)

        return ((left,bottom),(right,top))
1193339
public static String cutLast(String s) {
    return (s.length() == 0 ? "" : s.substring(0, s.length() - 1));
  }
451427
def cutout_data(self, x1, y1, x2, y2, xstep=1, ystep=1, astype=None):
        
        view = np.s_[y1:y2:ystep, x1:x2:xstep]
        data = self._slice(view)
        if astype:
            data = data.astype(astype, copy=False)
        return data
596739
def get_slice(self, start=None, end=None):
        
        if start is not None:
            start = min(max(0, start), len(self) - 1)
        else:
            start = 0
        if end is not None:
            end = min(max(0, end), len(self))
            end = max(end, start + 1)
        else:
            end = len(self)
        new_text = TextFile()
        for fragment in self.fragments[start:end]:
            new_text.add_fragment(fragment)
        return new_text
1252750
def get_value(self, subsystem, option):
        
        assert subsystem in self, 'Subsystem {} is missing'.format(subsystem)
        return util.read_file(self.per_subsystem[subsystem], subsystem + '.' + option)
1090485
def key(self, direction, mechanism, purviews=False, _prefix=None):
        """"""
        return "subsys:{}:{}:{}:{}:{}".format(
            self.subsystem_hash, _prefix, direction, mechanism, purviews)