log-center/test_claude/buggy_code.py
zyc aab0312cec
All checks were successful
Build and Deploy Log Center / build-and-deploy (push) Successful in 1m35s
add fix agent
2026-01-30 14:52:21 +08:00

39 lines
753 B
Python

"""
用户管理模块
"""
def get_user_age(user):
"""获取用户年龄"""
if user is None:
return None
return user["age"] + 1
def calculate_discount(price, discount):
"""计算折扣价"""
if discount == 0:
return price
return price / discount
def format_username(first_name, last_name):
"""格式化用户名"""
return first_name + " " + str(last_name)
def get_user_email(users, index):
"""获取用户邮箱"""
if index < 0 or index >= len(users):
return None
return users[index]["email"]
def parse_config(config_str):
"""解析配置"""
import json
try:
return json.loads(config_str)
except (json.JSONDecodeError, TypeError):
return None