parameters: (elem_type_func)
return_statement: return Interface
docstring: Returns a class (not an instance) that will provide a list-like
      interface with runtime type checks.
  
      Note: The types are provided lazily via a callable to avoid unnecessary dependencies
      on types from external packages at import-time.
  
      Args:
          elem_type_func (Callable() -> type):
                  A callable that returns the expected list-element type.
docstring_summary: Returns a class (not an instance) that will provide a list-like
      interface with runtime type checks.
docstring_tokens: Returns a class ( not an instance ) that will provide a list - like interface with runtime type checks .
function: def TypedList(elem_type_func):
      """
      Returns a class (not an instance) that will provide a list-like
      interface with runtime type checks.
  
      Note: The types are provided lazily via a callable to avoid unnecessary dependencies
      on types from external packages at import-time.
  
      Args:
          elem_type_func (Callable() -> type):
                  A callable that returns the expected list-element type.
      """
  
      class Interface(object):
          def __init__(self, lst=None):
              self.lst = util.default(lst, [])
              self.elem_type = elem_type_func()
  
          def _check_type(self, elem):
              if not isinstance(elem, self.elem_type):
                  G_LOGGER.critical(
                      "Unsupported element type type in {:}. Element: {:} is type: {:} but type: {:} was expected".format(
                          type(self).__name__, repr(elem), type(elem).__name__, self.elem_type.__name__
                      )
                  )
  
          def __contains__(self, key):
              return key in self.lst
  
          def __getitem__(self, index):
              return self.lst[index]
  
          def __setitem__(self, index, elem):
              self._check_type(elem)
              self.lst[index] = elem
  
          def __str__(self):
              return str(self.lst)
  
          def __repr__(self):
              return repr(self.lst)
  
          def append(self, elem):
              self._check_type(elem)
              return self.lst.append(elem)
  
          def extend(self, elems):
              for elem in elems:
                  self._check_type(elem)
              return self.lst.extend(elems)
  
          def __iadd__(self, elems):
              for elem in elems:
                  self._check_type(elem)
              self.lst += elems
  
          def __len__(self):
              return len(self.lst)
  
          def __eq__(self, other):
              return self.lst == other.lst
  
          def __iter__(self):
              return self.lst.__iter__()
  
          def __copy__(self):
              new_list = type(self)()
              new_list.__dict__.update(self.__dict__)
              new_list.lst = copy.copy(self.lst)
              return new_list
  
          def __deepcopy__(self, memo):
              new_list = type(self)()
              new_list.__dict__.update(self.__dict__)
              new_list.lst = copy.deepcopy(self.lst)
              return new_list
  
      return Interface
function_tokens: def TypedList ( elem_type_func ) : class Interface ( object ) : def __init__ ( self , lst = None ) : self . lst = util . default ( lst , [ ] ) self . elem_type = elem_type_func ( ) def _check_type ( self , elem ) : if not isinstance ( elem , self . elem_type ) : G_LOGGER . critical ( "Unsupported element type type in {:}. Element: {:} is type: {:} but type: {:} was expected" . format ( type ( self ) . __name__ , repr ( elem ) , type ( elem ) . __name__ , self . elem_type . __name__ ) ) def __contains__ ( self , key ) : return key in self . lst def __getitem__ ( self , index ) : return self . lst [ index ] def __setitem__ ( self , index , elem ) : self . _check_type ( elem ) self . lst [ index ] = elem def __str__ ( self ) : return str ( self . lst ) def __repr__ ( self ) : return repr ( self . lst ) def append ( self , elem ) : self . _check_type ( elem ) return self . lst . append ( elem ) def extend ( self , elems ) : for elem in elems : self . _check_type ( elem ) return self . lst . extend ( elems ) def __iadd__ ( self , elems ) : for elem in elems : self . _check_type ( elem ) self . lst += elems def __len__ ( self ) : return len ( self . lst ) def __eq__ ( self , other ) : return self . lst == other . lst def __iter__ ( self ) : return self . lst . __iter__ ( ) def __copy__ ( self ) : new_list = type ( self ) ( ) new_list . __dict__ . update ( self . __dict__ ) new_list . lst = copy . copy ( self . lst ) return new_list def __deepcopy__ ( self , memo ) : new_list = type ( self ) ( ) new_list . __dict__ . update ( self . __dict__ ) new_list . lst = copy . deepcopy ( self . lst ) return new_list return Interface