Skip to content

Commit 434c93b

Browse files
author
patched.codes[bot]
committed
Patched tests/cicd/generate_docstring/python_test_file.py
1 parent 30b699a commit 434c93b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/cicd/generate_docstring/python_test_file.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
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 to be added.
7+
b (int or float): The second number to be added.
8+
9+
Returns:
10+
int or float: The sum of the two numbers.
11+
"""
312
return a + b
413

514

615
def sqlite(db, query):
16+
"""Executes a given SQL query on a SQLite database and returns the results.
17+
18+
Args:
19+
db (sqlite3.Connection): A SQLite database connection object.
20+
query (str): The SQL query to be executed on the database.
21+
22+
Returns:
23+
list: A list of tuples containing the results of the query.
24+
"""
25+
726
cursor = db.cursor()
827
cursor.execute(query)
928
return cursor.fetchall()
1029

1130

1231
def compare(key_map, item1, item2):
32+
"""Compares two items based on a key mapping function and determines their order.
33+
34+
Args:
35+
key_map (function): A function that extracts a comparison key from each item.
36+
item1 (any): The first item to compare.
37+
item2 (any): The second item to compare.
38+
39+
Returns:
40+
int: -1 if item1 is less than item2, 1 if item1 is greater than item2, and 0 if they are equal.
41+
"""
1342
if key_map(item1) < key_map(item2):
1443
return -1
1544
elif key_map(item1) > key_map(item2):
@@ -21,4 +50,12 @@ def compare(key_map, item1, item2):
2150
def random_alphabets(
2251
length: int
2352
):
53+
"""Generates a random string of alphabets.
54+
55+
Args:
56+
length (int): The desired length of the output string.
57+
58+
Returns:
59+
str: A randomly generated string consisting of ASCII alphabets (both lower and uppercase) of the specified length.
60+
"""
2461
return ''.join(random.choices(string.ascii_letters, k=length))

0 commit comments

Comments
 (0)