class_docstr: Base class of all clips (VideoClips and AudioClips).
  
  Attributes
  ----------
  
  start : float
    When the clip is included in a composition, time of the
    composition at which the clip starts playing (in seconds).
  
  end : float
    When the clip is included in a composition, time of the
    composition at which the clip stops playing (in seconds).
  
  duration : float
    Duration of the clip (in seconds). Some clips are infinite, in
    this case their duration will be ``None``.
class_docstr_tok: ["Base","class","of","all","clips","(","VideoClips","and","AudioClips",")",".","Attributes","--","--","--","--","--","start",":","float","When","the","clip","is","included","in","a","composition",",","time","of","the","composition","at","which","the","clip","starts","playing","(","in","seconds",")",".","end",":","float","When","the","clip","is","included","in","a","composition",",","time","of","the","composition","at","which","the","clip","stops","playing","(","in","seconds",")",".","duration",":","float","Duration","of","the","clip","(","in","seconds",")",".","Some","clips","are","infinite",",","in","this","case","their","duration","will","be","``","None","``","."]
docstr: Support extended slice and index operations over
  a clip object.
  
  Simple slicing is implemented via `subclip`.
  So, ``clip[t_start:t_end]`` is equivalent to
  ``clip.subclip(t_start, t_end)``. If ``t_start`` is not
  given, default to ``0``, if ``t_end`` is not given,
  default to ``self.duration``.
  
  The slice object optionally support a third argument as
  a ``speed`` coefficient (that could be negative),
  ``clip[t_start:t_end:speed]``.
  
  For example ``clip[::-1]`` returns a reversed (a time_mirror fx)
  the video and ``clip[:5:2]`` returns the segment from 0 to 5s
  accelerated to 2x (ie. resulted duration would be 2.5s)
  
  In addition, a tuple of slices is supported, resulting in the concatenation
  of each segment. For example ``clip[(:1, 2:)]`` return a clip
  with the segment from 1 to 2s removed.
  
  If ``key`` is not a slice or tuple, we assume it's a time
  value (expressed in any format supported by `cvsec`)
  and return the frame at that time, passing the key
  to ``get_frame``.
docstr_tok: ["Support","extended","slice","and","index","operations","over","a","clip","object",".","Simple","slicing","is","implemented","via","`","subclip","`",".","So",",","``","clip","[","t_start",":","t_end","]","``","is","equivalent","to","``","clip.subclip","(","t_start",",","t_end",")","``",".","If","``","t_start","``","is","not","given",",","default","to","``","0","``",",","if","``","t_end","``","is","not","given",",","default","to","``","self.duration","``",".","The","slice","object","optionally","support","a","third","argument","as","a","``","speed","``","coefficient","(","that","could","be","negative",")",",","``","clip","[","t_start",":","t_end",":","speed","]","``",".","For","example","``","clip","[",":",":-1","]","``","returns","a","reversed","(","a","time_mirror","fx",")","the","video","and","``","clip","[",":5:2","]","``","returns","the","segment","from","0","to","5s","accelerated","to","2x","(","ie",".","resulted","duration","would","be","2.5s",")","In","addition",",","a","tuple","of","slices","is","supported",",","resulting","in","the","concatenation","of","each","segment",".","For","example","``","clip","[","(",":1",",","2",":",")","]","``","return","a","clip","with","the","segment","from","1","to","2s","removed",".","If","``","key","``","is","not","a","slice","or","tuple",",","we","assume","it","'s","a","time","value","(","expressed","in","any","format","supported","by","`","cvsec","`",")","and","return","the","frame","at","that","time",",","passing","the","key","to","``","get_frame","``","."]
code: def __getitem__(self, key):
      """
      Support extended slice and index operations over
      a clip object.
  
      Simple slicing is implemented via `subclip`.
      So, ``clip[t_start:t_end]`` is equivalent to
      ``clip.subclip(t_start, t_end)``. If ``t_start`` is not
      given, default to ``0``, if ``t_end`` is not given,
      default to ``self.duration``.
  
      The slice object optionally support a third argument as
      a ``speed`` coefficient (that could be negative),
      ``clip[t_start:t_end:speed]``.
  
      For example ``clip[::-1]`` returns a reversed (a time_mirror fx)
      the video and ``clip[:5:2]`` returns the segment from 0 to 5s
      accelerated to 2x (ie. resulted duration would be 2.5s)
  
      In addition, a tuple of slices is supported, resulting in the concatenation
      of each segment. For example ``clip[(:1, 2:)]`` return a clip
      with the segment from 1 to 2s removed.
  
      If ``key`` is not a slice or tuple, we assume it's a time
      value (expressed in any format supported by `cvsec`)
      and return the frame at that time, passing the key
      to ``get_frame``.
      """
      apply_to = ["mask", "audio"]
      if isinstance(key, slice):
          # support for [start:end:speed] slicing. If speed is negative
          # a time mirror is applied.
          clip = self.subclip(key.start or 0, key.stop or self.duration)
  
          if key.step:
              # change speed of the subclip
              factor = abs(key.step)
              if factor != 1:
                  # change speed
                  clip = clip.time_transform(
                      lambda t: factor * t,
                      apply_to=apply_to,
                      keep_duration=True,
                  )
                  clip = clip.with_duration(
                      1.0 * clip.duration / factor
                  )
              if key.step < 0:
                  # time mirror
                  clip = clip.time_transform(
                      lambda t: clip.duration - t - 1,
                      keep_duration=True,
                      apply_to=apply_to,
                  )
          return clip
      elif isinstance(key, tuple):
          # get a concatenation of subclips
          return reduce(add, (self[k] for k in key))
      else:
          return self.get_frame(key)
  
imports: import copy
  from functools import reduce
  from numbers import Real
  from operator import add
  import numpy
  import proglog
  from moviepy.decorators import apply_to_audio, apply_to_mask, convert_parameter_to_seconds, outplace, requires_duration, use_clip_fps_by_default
label_desc: Use image node_id 22 for calling the Clip obj's underlying member method code with example usage: obj.__getitem__(key) and returns: clip, reduce, self