def count_methods(code_str):
    """
    Counts the number of methods/functions in a given string of code.

    Args:
    code_str (str): A string containing code.

    Returns:
    int: The number of methods/functions found.
    """
    # Regular expression to find Python function definitions
    pattern = r'\bdef\b\s+\w+\s*\('
    matches = re.findall(pattern, code_str)
    return len(matches)

    Counts the number of methods/functions in a given string of code.

    Args:
    code_str (str): A string containing code.

    Returns:
    int: The number of methods/functions found.
    
evaluation/benchmarks/testgeneval/report_utils.py