parameters: (num_elements=1000)
return_statement: return "<html>" + "\n".join(elements) + "</html>"
docstring: Randomly generate an invalid HTML document.
docstring_summary: Randomly generate an invalid HTML document.
docstring_tokens: Randomly generate an invalid HTML document .
function: def rdoc(num_elements=1000):
      """Randomly generate an invalid HTML document."""
      tag_names = ['p', 'div', 'span', 'i', 'b', 'script', 'table']
      elements = []
      for i in range(num_elements):
          choice = random.randint(0,3)
          if choice == 0:
              # New tag.
              tag_name = random.choice(tag_names)
              elements.append("<%s>" % tag_name)
          elif choice == 1:
              elements.append(rsentence(random.randint(1,4)))
          elif choice == 2:
              # Close a tag.
              tag_name = random.choice(tag_names)
              elements.append("</%s>" % tag_name)
      return "<html>" + "\n".join(elements) + "</html>"
function_tokens: def rdoc ( num_elements = 1000 ) : tag_names = [ 'p' , 'div' , 'span' , 'i' , 'b' , 'script' , 'table' ] elements = [ ] for i in range ( num_elements ) : choice = random . randint ( 0 , 3 ) if choice == 0 : # New tag. tag_name = random . choice ( tag_names ) elements . append ( "<%s>" % tag_name ) elif choice == 1 : elements . append ( rsentence ( random . randint ( 1 , 4 ) ) ) elif choice == 2 : # Close a tag. tag_name = random . choice ( tag_names ) elements . append ( "</%s>" % tag_name ) return "<html>" + "\n" . join ( elements ) + "</html>"