mirror of
https://github.com/huggingface/transformers.git
synced 2025-10-20 09:03:53 +08:00
* Apply ruff FURB rules Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> * Enable ruff FURB rules Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> * More fixes Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> * More fixes Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> * Revert changes Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> * More fixes Signed-off-by: Yuanyuan Chen <cyyever@outlook.com> --------- Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
74 lines
2.5 KiB
TOML
74 lines
2.5 KiB
TOML
[tool.coverage.run]
|
|
source = ["transformers"]
|
|
omit = [
|
|
"*/convert_*",
|
|
"*/__main__.py"
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"raise",
|
|
"except",
|
|
"register_parameter"
|
|
]
|
|
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 119
|
|
|
|
[tool.ruff.lint]
|
|
# Never enforce `E501` (line length violations).
|
|
# SIM300: Yoda condition detected
|
|
# SIM212: Checks for if expressions that check against a negated condition.
|
|
# SIM905: Consider using a list literal instead of `str.split`
|
|
# UP009: UTF-8 encoding declaration is unnecessary
|
|
# UP015: Unnecessary mode argument
|
|
# UP031: Use format specifiers instead of percent format
|
|
# UP004: Class `XXX` inherits from `object`
|
|
# UP028: Checks for for loops that can be replaced with yield from expressions
|
|
# UP045: Use `X | None` for type annotations
|
|
# UP007: Use `X | Y` for type annotations
|
|
ignore = ["C901", "E501", "E741", "F402", "F823", "SIM1", "SIM300", "SIM212", "SIM905", "UP009", "UP015", "UP031", "UP028", "UP004", "UP045", "UP007"]
|
|
# RUF013: Checks for the use of implicit Optional
|
|
# in type annotations when the default parameter value is None.
|
|
select = ["C", "E", "F", "I", "W", "RUF013", "PERF102", "PLC1802", "PLC0208", "SIM", "UP", "PIE794", "FURB"]
|
|
extend-safe-fixes = ["UP006"]
|
|
|
|
# Ignore import violations in all `__init__.py` files.
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"__init__.py" = ["E402", "F401", "F403", "F811"]
|
|
"src/transformers/file_utils.py" = ["F401"]
|
|
"src/transformers/utils/dummy_*.py" = ["F401"]
|
|
"examples/legacy/**/*.py" = ["UP"]
|
|
|
|
[tool.ruff.lint.isort]
|
|
lines-after-imports = 2
|
|
known-first-party = ["transformers"]
|
|
|
|
[tool.ruff.format]
|
|
# Like Black, use double quotes for strings.
|
|
quote-style = "double"
|
|
|
|
# Like Black, indent with spaces, rather than tabs.
|
|
indent-style = "space"
|
|
|
|
# Like Black, respect magic trailing commas.
|
|
skip-magic-trailing-comma = false
|
|
|
|
# Like Black, automatically detect the appropriate line ending.
|
|
line-ending = "auto"
|
|
|
|
[tool.pytest.ini_options]
|
|
addopts = "--doctest-glob='**/*.md'"
|
|
doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
|
|
markers = [
|
|
"flash_attn_3_test: marks tests related to flash attention 3 (deselect with '-m \"not flash_attn_3_test\"')",
|
|
"flash_attn_test: marks tests related to flash attention (deselect with '-m \"not flash_attn_test\"')",
|
|
"bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests",
|
|
"generate: marks tests that use the GenerationTesterMixin"
|
|
]
|
|
log_cli = 1
|
|
log_cli_level = "WARNING"
|
|
asyncio_default_fixture_loop_scope = "function"
|