class_docstr: Dataclass representing a bazel py_test rule (BUILD entry).
  
  Only the subset of fields we care about is included.
class_docstr_tok: ["Dataclass","representing","a","bazel","py_test","rule","(","BUILD","entry",")",".","Only","the","subset","of","fields","we","care","about","is","included","."]
docstr: Create a BazelRule from an XML element.
  
  The XML element is expected to be produced by the
  ``bazel query --output=xml`` command.
docstr_tok: ["Create","a","BazelRule","from","an","XML","element",".","The","XML","element","is","expected","to","be","produced","by","the","``","bazel","query","--","output=xml","``","command","."]
code: def from_xml_element(cls, element: ET.Element) -> "BazelRule":
      """Create a BazelRule from an XML element.
  
      The XML element is expected to be produced by the
      ``bazel query --output=xml`` command.
      """
      name = element.get("name")
      all_string_tags = element.findall("string")
      size = next(
          (
              tag.get("value")
              for tag in all_string_tags
              if tag.get("name") == "size"
          ),
          "medium",
      )
      timeout = next(
          (
              tag.get("value")
              for tag in all_string_tags
              if tag.get("name") == "timeout"
          ),
          None,
      )
      return cls(name=name, size=size, timeout=timeout)
  
imports: from collections import defaultdict
  from dataclasses import dataclass
  from typing import Iterable, List, Optional, Set, Tuple
  import argparse
  import os
  import re
  import shlex
  import subprocess
  import sys
  import xml.etree.ElementTree
label_desc: Use image node_id 5 for calling the BazelRule obj's underlying member method code with example usage: obj.from_xml_element(cls, element) and returns: cls