Skip to content

Commit 6aab72c

Browse files
author
patched.codes[bot]
committed
Patched tests/cicd/generate_docstring/python_test_file.py
1 parent c953072 commit 6aab72c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/cicd/generate_docstring/python_test_file.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
11
# fmt: off
22
def a_plus_b(a, b):
3+
"""Adds two numbers together.
4+
5+
Args:
6+
a (int or float): The first number.
7+
b (int or float): The second number.
8+
9+
Returns:
10+
int or float: The sum of `a` and `b`.
11+
"""
12+
313
return a + b
414

515

616
def sqlite(db, query):
17+
"""Executes an SQL query on a given SQLite database and returns the results.
18+
19+
Args:
20+
db (sqlite3.Connection): The SQLite database connection object.
21+
query (str): The SQL query string to be executed on the database.
22+
23+
Returns:
24+
list: A list of tuples containing the results of the executed query.
25+
"""
26+
727
cursor = db.cursor()
828
cursor.execute(query)
929
return cursor.fetchall()
1030

1131

1232
def compare(key_map, item1, item2):
33+
"""
34+
Compares two items based on a key function.
35+
36+
Args:
37+
key_map (function): A function that extracts a comparison key from each item.
38+
item1 (any): The first item to compare.
39+
item2 (any): The second item to compare.
40+
41+
Returns:
42+
int: Returns -1 if item1 is less than item2, 1 if item1 is greater than item2, and 0 if they are equal.
43+
"""
1344
if key_map(item1) < key_map(item2):
1445
return -1
1546
elif key_map(item1) > key_map(item2):
@@ -21,4 +52,13 @@ def compare(key_map, item1, item2):
2152
def random_alphabets(
2253
length: int
2354
):
55+
"""Generate a random string of alphabets.
56+
57+
Args:
58+
length (int): The length of the string to generate.
59+
60+
Returns:
61+
str: A string containing random alphabetic characters of the specified length.
62+
"""
63+
2464
return ''.join(random.choices(string.ascii_letters, k=length))

0 commit comments

Comments
 (0)