content: [tool.black]
  line-length = 88
  target-version = ['py39', 'py310', 'py311']
  include = '\.pyi?$'
  extend-exclude = '''
  /(
    # directories
    \.eggs
    | \.git
    | \.hg
    | \.mypy_cache
    | \.tox
    | \.venv
    | _build
    | buck-out
    | build
    | dist
    | __pycache__
  )/
  '''
  
  [tool.isort]
  profile = "black"
  multi_line_output = 3
  line_length = 88
  include_trailing_comma = true
  force_grid_wrap = 0
  use_parentheses = true
  ensure_newline_before_comments = true
  known_first_party = ["config", "db", "engine", "model", "service", "utils"]
  known_third_party = ["locust", "sqlalchemy", "pymysql", "tiktoken", "loguru", "fastapi", "uvicorn"]
  
  [tool.flake8]
  max-line-length = 88
  extend-ignore = [
      # E203: whitespace before ':' (conflicts with black)
      "E203",
      # W503: line break before binary operator (conflicts with black)
      "W503",
      # E501: line too long (handled by black)
      "E501",
      # D100: Missing docstring in public module
      "D100",
      # D101: Missing docstring in public class
      "D101",
      # D104: Missing docstring in public package
      "D104",
      # D200: One-line docstring should fit on one line with quotes
      "D200",
      # D202: No blank lines allowed after function docstring
      "D202",
      # D205: 1 blank line required between summary line and description
      "D205",
      # D212: Multi-line docstring summary should start at the first line
      "D212",
      # D403: First word of the first line should be properly capitalized
      "D403",
      # D411: Missing blank line before section
      "D411",
      # D415: First line should end with a period, question mark, or exclamation point
      "D415",
      # B007: Loop control variable not used within the loop body
      "B007",
      # B008: Do not perform function calls in argument defaults (common in FastAPI)
      "B008",
      # F541: f-string is missing placeholders (sometimes intentional for consistency)
      "F541",
      # F823: local variable referenced before assignment (often false positive)
      "F823",
      # F841: local variable is assigned to but never used
      "F841",
      # Additional ignores for less strict checking
      "E712", # comparison to True should be 'if cond is True:' or 'if cond:'
      "E722", # do not use bare 'except'
      "E741", # ambiguous variable name
      "W292", # no newline at end of file
      "W293", # blank line contains whitespace
      # I100: Import statements are in the wrong order
      "I100",
      # I101: Imported names are in the wrong order
      "I101",
      # I202: Additional newline in a group of imports
      "I202",
      # W391: blank line at end of file
      "W391",
      # F403: 'from module import *' used; unable to detect undefined names
      "F403",
      # F405: name may be undefined, or defined from star imports
      "F405",
  ]
  exclude = [
      ".git",
      "__pycache__",
      ".venv",
      ".eggs",
      "*.egg",
      "build",
      "dist",
      ".mypy_cache",
      ".pytest_cache"
  ]
  per-file-ignores = [
      # __init__.py files can have unused imports and be empty
      "__init__.py:F401,D104,W391,E261",
      # Test files can have unused imports and long lines
      "test_*.py:F401,E501,D100,D103",
      "*_test.py:F401,E501,D100,D103",
      # Engine files can use star imports and function calls in defaults
      "engine/*.py:F403,F405,B008,C901",
      # Service files can use star imports
      "service/*.py:F403,F405",
      # Utils files can be complex
      "utils/*.py:C901",
  ]
  max-complexity = 20
  import-order-style = "google"
  docstring-convention = "google"
  
  [tool.mypy]
  python_version = "3.9"
  # completely disable type checking
  ignore_errors = true
  ignore_missing_imports = true
  follow_imports = "skip"
  # base settings
  warn_return_any = false
  warn_unused_configs = false
  show_error_codes = false
  
  # relax type check requirements
  disallow_untyped_defs = false
  disallow_incomplete_defs = false
  check_untyped_defs = false
  disallow_untyped_decorators = false
  no_implicit_optional = false
  disallow_any_generics = false
  disallow_any_unimported = false
  disallow_subclassing_any = false
  
  # disable warnings
  warn_redundant_casts = false
  warn_unused_ignores = false
  warn_no_return = false
  warn_unreachable = false
  strict_equality = false
  strict_optional = false
  allow_redefinition = true
  implicit_reexport = true
  
  # ignore common third-party libraries
  [[tool.mypy.overrides]]
  module = [
      "locust.*",
      "aiomysql.*",
      "pymysql.*",
      "tiktoken.*",
      "greenlet.*",
      "sqlalchemy.*",
      "loguru.*",
      "fastapi.*",
      "pydantic.*",
      "uvicorn.*",
      "starlette.*",
  ]
  ignore_missing_imports = true
  
  # relax requirements for specific files
  [[tool.mypy.overrides]]
  module = [
      "config.*",
      "db.*",
      "engine.*",
      "model.*",
      "service.*",
      "utils.*",
  ]
  disallow_untyped_defs = false
  disallow_incomplete_defs = false
  check_untyped_defs = false
  warn_return_any = false
  ignore_errors = true
  follow_imports = "skip"
  follow_imports_for_stubs = false
  
  # SQLAlchemy specific overrides
  [[tool.mypy.overrides]]
  module = ["sqlalchemy.*"]
  ignore_missing_imports = true
  ignore_errors = true
  
  [tool.pytest.ini_options]
  testpaths = ["tests"]
  python_files = ["test_*.py", "*_test.py"]
  python_classes = ["Test*"]
  python_functions = ["test_*"]
  addopts = [
      "--strict-markers",
      "--strict-config",
      "--cov=.",
      "--cov-report=term-missing",
      "--cov-report=html",
      "--cov-report=xml",
  ]
  markers = [
      "slow: marks tests as slow (deselect with '-m \"not slow\"')",
      "integration: marks tests as integration tests",
  ]
  
  [tool.bandit]
  exclude_dirs = ["tests"]
  skips = ["B101", "B601"]
  