Spaces:
Sleeping
Sleeping
File size: 4,009 Bytes
acd8e16 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
cases:
- id: "api_documentation"
question: "Create documentation for a REST API endpoint that handles user authentication"
reference_doc: |
# User Authentication API
## POST /api/auth/login
Authenticates a user and returns a JWT token.
### Request Body
```json
{
"username": "string",
"password": "string"
}
```
### Response
```json
{
"token": "string",
"expires_in": 3600,
"user": {
"id": 1,
"username": "string",
"email": "string"
}
}
```
### Status Codes
- `200 OK`: Authentication successful
- `401 Unauthorized`: Invalid credentials
- `400 Bad Request`: Missing or invalid request body
difficulty: "medium"
description: "API endpoint documentation"
- id: "function_documentation"
question: "Create documentation for a Python function that calculates the factorial of a number"
reference_doc: |
## factorial(n)
Calculates the factorial of a given number.
### Parameters
- `n` (int): The number to calculate factorial for. Must be non-negative.
### Returns
- `int`: The factorial of n
### Raises
- `ValueError`: If n is negative
### Examples
```python
>>> factorial(5)
120
>>> factorial(0)
1
>>> factorial(-1)
ValueError: Factorial is not defined for negative numbers
```
difficulty: "easy"
description: "Function documentation with examples"
- id: "class_documentation"
question: "Create documentation for a Python class that represents a bank account"
reference_doc: |
## BankAccount
A class representing a bank account with basic operations.
### Attributes
- `balance` (float): The current account balance
- `account_number` (str): Unique account identifier
### Methods
#### `__init__(self, account_number: str, initial_balance: float = 0.0)`
Initialize a new bank account.
#### `deposit(self, amount: float) -> bool`
Deposit money into the account.
- **Parameters**: `amount` (float): Amount to deposit (must be positive)
- **Returns**: `bool`: True if successful, False otherwise
#### `withdraw(self, amount: float) -> bool`
Withdraw money from the account.
- **Parameters**: `amount` (float): Amount to withdraw (must be positive and <= balance)
- **Returns**: `bool`: True if successful, False otherwise
#### `get_balance(self) -> float`
Get the current account balance.
- **Returns**: `float`: Current balance
difficulty: "medium"
description: "Class documentation with methods"
- id: "installation_guide"
question: "Create installation and setup documentation for a Python package"
reference_doc: |
# Installation Guide
## Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
## Installation
### Using pip
```bash
pip install my-package
```
### From source
```bash
git clone https://github.com/user/my-package.git
cd my-package
pip install -e .
```
## Configuration
Create a configuration file `config.yaml`:
```yaml
database:
host: localhost
port: 5432
name: myapp
api:
base_url: https://api.example.com
timeout: 30
```
## Quick Start
```python
from my_package import MyClass
# Initialize
app = MyClass()
# Use the application
result = app.process_data("input")
print(result)
```
difficulty: "hard"
description: "Complete installation and setup guide"
|