-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Task
Review all functions in the codebase to ensure each has a clear, well-defined signature and a comprehensive docstring. Each docstring should explain the function's purpose, expected input parameters (with types), return values (with types), and any important side effects or exceptions.
What are Function Signatures?
A function signature is the part of the function definition that specifies the function's name, its parameters (including their names and types), and the return type. A clear signature helps users and developers understand how to call the function and what to expect.
Example:
def add_numbers(a: int, b: int) -> int:
"""Add two integers and return the result."""
What are Docstrings?
A docstring is a special string literal that appears right after the function definition. It documents the function's purpose, describes its parameters and return values, and provides any additional context or usage notes. Good docstrings improve code readability and maintainability.
Example:
def add_numbers(a: int, b: int) -> int:
"""
Add two integers.
Args:
a (int): The first integer.
b (int): The second integer.
Returns:
int: The sum of a and b.
"""
AI Prompt for MS Copilot GPT-4.1
Start with pdf functions file. Make a list of all of the functions and add this list to the new issue. Make a table that grades the function signatures and the docstrings for each function in the file.
Acceptance Criteria
- Every function in the codebase has a clear, type-annotated signature.
- Every function has a docstring that explains its purpose, parameters, return values, and any exceptions or side effects.
- Docstrings follow a consistent style (e.g., Google, NumPy, or reStructuredText).
Functions in pdfcb_03b_pdffunctions.py
Function/Class | Signature Present | Type Annotations | Docstring Present | Docstring Quality |
---|---|---|---|---|
PDF.__init__ |
Yes | Yes | No | N/A |
PDF.header |
Yes | No | No | N/A |
PDF.footer |
Yes | No | No | N/A |
PDF.get_col_widths |
Yes | Partial | Yes | Minimal |
PDF.create_table |
Yes | Partial | Yes | Good |
Function List
PDF.__init__(self, header_text: str = "Header Text", footer_text: str = "Footer Text", image_path: str = "")
PDF.header(self)
PDF.footer(self)
PDF.get_col_widths(self, cell_width, data, table_data)
PDF.create_table(self, table_data, title='', data_size=10, title_size=12, align_data='L', align_header='L', cell_width='uneven', line_space=2.5)
Table: Signature and Docstring Grading
Function | Signature (A-F) | Type Annotations (A-F) | Docstring (A-F) |
---|---|---|---|
__init__ |
A | A | F |
header |
A | F | F |
footer |
A | F | F |
get_col_widths |
A | C | D |
create_table |
A | C | B |
Legend:
- Signature: A = clear, B = minor issues, C = missing defaults/types, D = unclear, F = missing
- Type Annotations: A = all present, C = some missing, F = none
- Docstring: A = excellent, B = good, C = adequate, D = minimal, F = missing
This table can be used to prioritize improvements for each function.