parameters: (item)
return_statement: return [item]
docstring: For compound items returns a list of all component sub-items.
      For non-compound items, returns a singular item.
docstring_summary: For compound items returns a list of all component sub-items.
      For non-compound items, returns a singular item.
docstring_tokens: For compound items returns a list of all component sub - items . For non - compound items returns a singular item .
function: def components(item):
      """For compound items returns a list of all component sub-items.
      For non-compound items, returns a singular item."""
      if isinstance(item,WorldModel):
          res = [item.robot(i) for i in range(item.numRobots())]
          res += [item.rigidObject(i) for i in range(item.numRigidObjects())]
          return res
      elif isinstance(item,coordinates.Group):
          res = list(item.frames.values())
          res += list(item.points.values())
          res += list(item.directions.values())
          res += [components(g) for g in item.subgroups.values()]
          return res
      elif hasattr(item,'__iter__'):
          if all(isinstance(v,(bool,int,float,str)) for v in item):
              return [item]
          return sum([components(v) for v in item],[])
      return [item]
function_tokens: def components ( item ) : if isinstance ( item , WorldModel ) : res = [ item . robot ( i ) for i in range ( item . numRobots ( ) ) ] res += [ item . rigidObject ( i ) for i in range ( item . numRigidObjects ( ) ) ] return res elif isinstance ( item , coordinates . Group ) : res = list ( item . frames . values ( ) ) res += list ( item . points . values ( ) ) res += list ( item . directions . values ( ) ) res += [ components ( g ) for g in item . subgroups . values ( ) ] return res elif hasattr ( item , '__iter__' ) : if all ( isinstance ( v , ( bool , int , float , str ) ) for v in item ) : return [ item ] return sum ( [ components ( v ) for v in item ] , [ ] ) return [ item ]