generated from brenozd/python-template
fix: updating config-example.toml
This commit is contained in:
@@ -1,254 +1,9 @@
|
||||
[llm]
|
||||
base_url = "https://openrouter.ai/api/v1"
|
||||
api_key = ""
|
||||
model = "openai/gpt-oss-120b"
|
||||
model = "google/gemini-2.5-flash-lite"
|
||||
|
||||
[language.c]
|
||||
name = "Doxygen"
|
||||
output_requirement="""
|
||||
- The documentation output MUST be a valid comment in the style required for the code language:
|
||||
* For C or C++ → use Doxygen comment blocks: `/** ... */`
|
||||
- The model must return ONLY the comment block—NO text, NO markdown fences, NO explanations.
|
||||
- The comment must be ready to paste directly above the code.
|
||||
"""
|
||||
example = """
|
||||
/**
|
||||
* @brief Calculates the factorial of a number.
|
||||
*
|
||||
* This function computes the factorial of a given non-negative integer.
|
||||
*
|
||||
* @param n A non-negative integer.
|
||||
* @return The factorial of n. Returns 1 if n is 0 or 1.
|
||||
* @exception std::invalid_argument If n is negative.
|
||||
*
|
||||
* Example usage:
|
||||
* @code
|
||||
* int result = factorial(5); // result = 120
|
||||
* @endcode
|
||||
*/
|
||||
int factorial(int n) {
|
||||
if (n < 0) {
|
||||
throw std::invalid_argument("n must be non-negative");
|
||||
}
|
||||
return (n <= 1) ? 1 : n * factorial(n - 1);
|
||||
}
|
||||
|
||||
// Additional: Class documentation example
|
||||
/**
|
||||
* @brief A class to represent a simple calculator.
|
||||
*
|
||||
* This class provides basic arithmetic operations and maintains a history of operations.
|
||||
*
|
||||
* @author John Doe
|
||||
* @version 1.0
|
||||
* @date 2023-10-01
|
||||
*/
|
||||
class Calculator {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a Calculator object.
|
||||
*
|
||||
* Initializes the calculator with no history.
|
||||
*/
|
||||
Calculator() {}
|
||||
|
||||
/**
|
||||
* @brief Adds two numbers.
|
||||
*
|
||||
* @param a First operand.
|
||||
* @param b Second operand.
|
||||
* @return Sum of a and b.
|
||||
* @note This operation is logged in history.
|
||||
*/
|
||||
int add(int a, int b) {
|
||||
history.push_back("add: " + std::to_string(a) + " + " + std::to_string(b));
|
||||
return a + b;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> history; ///< Operation history list.
|
||||
};
|
||||
"""
|
||||
|
||||
[language.cpp]
|
||||
name = "Doxygen"
|
||||
output_requirement="""
|
||||
- The documentation output MUST be a valid comment in the style required for the code language:
|
||||
* For C++ → use Doxygen comment blocks: `/** ... */`
|
||||
- The model must return ONLY the comment block—NO text, NO markdown fences, NO explanations.
|
||||
- The comment must be ready to paste directly above the code.
|
||||
"""
|
||||
example = """
|
||||
/**
|
||||
* @brief Calculates the factorial of a number.
|
||||
*
|
||||
* This function computes the factorial of a given non-negative integer.
|
||||
*
|
||||
* @param n A non-negative integer.
|
||||
* @return The factorial of n. Returns 1 if n is 0 or 1.
|
||||
* @exception std::invalid_argument If n is negative.
|
||||
*
|
||||
* Example usage:
|
||||
* @code
|
||||
* int result = factorial(5); // result = 120
|
||||
* @endcode
|
||||
*/
|
||||
int factorial(int n) {
|
||||
if (n < 0) {
|
||||
throw std::invalid_argument("n must be non-negative");
|
||||
}
|
||||
return (n <= 1) ? 1 : n * factorial(n - 1);
|
||||
}
|
||||
|
||||
// Additional: Class documentation example
|
||||
/**
|
||||
* @brief A class to represent a simple calculator.
|
||||
*
|
||||
* This class provides basic arithmetic operations and maintains a history of operations.
|
||||
*
|
||||
* @author Jane Smith
|
||||
* @version 2.0
|
||||
* @since 1.0
|
||||
* @deprecated This class is planned for replacement in v3.0. Use AdvancedCalculator instead.
|
||||
*/
|
||||
class Calculator {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a Calculator object.
|
||||
*
|
||||
* Initializes the calculator with no history.
|
||||
*/
|
||||
Calculator() : history() {}
|
||||
|
||||
/**
|
||||
* @brief Adds two numbers.
|
||||
*
|
||||
* @param a First operand (float for precision).
|
||||
* @param b Second operand (float for precision).
|
||||
* @return Sum of a and b.
|
||||
* @exception std::overflow_error If the result exceeds float limits.
|
||||
* @note This operation is logged in history.
|
||||
*
|
||||
* Example usage:
|
||||
* @code
|
||||
* Calculator calc;
|
||||
* float result = calc.add(1.5f, 2.0f); // result = 3.5
|
||||
* @endcode
|
||||
*/
|
||||
float add(float a, float b) {
|
||||
if (std::isinf(a + b)) {
|
||||
throw std::overflow_error("Result too large for float");
|
||||
}
|
||||
history.push_back("add: " + std::to_string(a) + " + " + std::to_string(b));
|
||||
return a + b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves operation history.
|
||||
*
|
||||
* @return A vector of strings representing past operations.
|
||||
*/
|
||||
std::vector<std::string> getHistory() const {
|
||||
return history;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> history; ///< Operation history list; accessible only within the class.
|
||||
};
|
||||
"""
|
||||
|
||||
[language.python]
|
||||
name = "Google"
|
||||
output_requirement="""
|
||||
- The documentation output MUST be a valid comment in the style required for the code language:
|
||||
* For Python → use triple-quoted docstrings: `\""" ... \"""`
|
||||
- The model must return ONLY the comment block—NO text, NO markdown fences, NO explanations.
|
||||
- The comment must be ready to paste directly above the code.
|
||||
"""
|
||||
example = """
|
||||
\"\"\"Function to calculate the factorial of a number.
|
||||
|
||||
Args:
|
||||
n (int): A non-negative integer. Must be >= 0.
|
||||
|
||||
Returns:
|
||||
int: The factorial of n. Returns 1 if n is 0 or 1.
|
||||
|
||||
Example:
|
||||
>>> factorial(5)
|
||||
120
|
||||
|
||||
Raises:
|
||||
ValueError: If n is negative.
|
||||
\"\"\"
|
||||
def factorial(n):
|
||||
if n < 0:
|
||||
raise ValueError("n must be non-negative")
|
||||
return 1 if n <= 1 else n * factorial(n - 1)
|
||||
|
||||
# Additional: Class documentation example
|
||||
\"\"\"A class for managing a simple bank account.
|
||||
|
||||
This class allows users to deposit, withdraw, and check balance with built-in validation
|
||||
and transaction history. It demonstrates Google-style docstrings for classes, including
|
||||
attributes and methods.
|
||||
|
||||
Attributes:
|
||||
balance (float): The current account balance.
|
||||
transactions (list of str): A history of transactions performed on the account.
|
||||
|
||||
Methods:
|
||||
deposit(amount): Adds money to the balance.
|
||||
withdraw(amount): Subtracts money from the balance if sufficient funds exist.
|
||||
get_balance(): Returns the current balance.
|
||||
\"\"\"
|
||||
class BankAccount:
|
||||
\"\"\"Initializes a BankAccount with zero balance and empty transaction history.
|
||||
|
||||
Raises:
|
||||
ValueError: If initial_balance is negative (future extension).
|
||||
\"\"\"
|
||||
def __init__(self, initial_balance: float = 0.0):
|
||||
if initial_balance < 0:
|
||||
raise ValueError("Initial balance cannot be negative")
|
||||
self.balance = initial_balance
|
||||
self.transactions = []
|
||||
|
||||
def deposit(self, amount: float) -> None:
|
||||
\"\"\"Deposits a specified amount into the account.
|
||||
|
||||
Args:
|
||||
amount (float): The amount to deposit. Must be positive.
|
||||
|
||||
Raises:
|
||||
ValueError: If amount is not positive.
|
||||
\"\"\"
|
||||
if amount <= 0:
|
||||
raise ValueError("Deposit amount must be positive")
|
||||
self.balance += amount
|
||||
self.transactions.append(f"Deposited: {amount}")
|
||||
|
||||
def withdraw(self, amount: float) -> None:
|
||||
\"\"\"Withdraws a specified amount from the account.
|
||||
|
||||
Args:
|
||||
amount (float): The amount to withdraw. Must be positive and not exceed balance.
|
||||
|
||||
Raises:
|
||||
ValueError: If amount is not positive or exceeds balance.
|
||||
\"\"\"
|
||||
if amount <= 0:
|
||||
raise ValueError("Withdrawal amount must be positive")
|
||||
if amount > self.balance:
|
||||
raise ValueError("Insufficient funds")
|
||||
self.balance -= amount
|
||||
self.transactions.append(f"Withdrew: {amount}")
|
||||
|
||||
def get_balance(self) -> float:
|
||||
\"\"\"Returns the current balance of the account.
|
||||
|
||||
Returns:
|
||||
float: The account balance.
|
||||
\"\"\"
|
||||
return self.balance
|
||||
"""
|
||||
[documentation_styles]
|
||||
c = "Doxygen"
|
||||
cpp = "Doxygen"
|
||||
python = "Numpy Docstring"
|
||||
|
||||
Reference in New Issue
Block a user