From 6ba7e310b7f15cb2193d3df4cc085f6dc8b7fe01 Mon Sep 17 00:00:00 2001 From: "patched.codes[bot]" <298395+patched.codes[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:20:22 +0000 Subject: [PATCH] Patched /tmp/tmpmuoxep8x/tests/cicd/generate_docstring/python_test_file.py --- .../generate_docstring/python_test_file.py | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/cicd/generate_docstring/python_test_file.py b/tests/cicd/generate_docstring/python_test_file.py index 4e88cbf0..a9296731 100644 --- a/tests/cicd/generate_docstring/python_test_file.py +++ b/tests/cicd/generate_docstring/python_test_file.py @@ -1,14 +1,44 @@ def a_plus_b(a, b): - return a + b + """ + Adds two numbers together. + + Args: + a (int or float): The first number to be added. + b (int or float): The second number to be added. + + Returns: + int or float: The sum of a and b. + """ return a + b def sqlite(db, query): + """ + Executes an SQL query on a given SQLite database and returns all the results. + + Args: + db (sqlite3.Connection): An open SQLite database connection. + query (str): The SQL query to execute on the database. + + Returns: + list: A list of tuples containing all the rows returned by the query. + """ cursor = db.cursor() cursor.execute(query) return cursor.fetchall() def compare(key_map, item1, item2): + """ + Compares two items based on a key mapping function. + + Args: + key_map (callable): A function that extracts a comparable key from an item. + item1 (Any): The first item to compare. + item2 (Any): The second item to compare. + + Returns: + int: -1 if item1 < item2, 1 if item1 > item2, 0 if they are equal. + """ if key_map(item1) < key_map(item2): return -1 elif key_map(item1) > key_map(item2): @@ -19,4 +49,13 @@ def compare(key_map, item1, item2): def random_alphabets( length: int ): + """ + Generates a random string of alphabets. + + Args: + length (int): The desired length of the random string. + + Returns: + str: A random string consisting of ASCII letters with the specified length. + """ return ''.join(random.choices(string.ascii_letters, k=length)) \ No newline at end of file