Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Use ruff
Browse files- .pre-commit-config.yaml +5 -16
- .vscode/settings.json +2 -8
- pyproject.toml +21 -9
- src/populate.py +2 -1
.pre-commit-config.yaml
CHANGED
@@ -10,21 +10,10 @@ repos:
|
|
10 |
- id: requirements-txt-fixer
|
11 |
- id: end-of-file-fixer
|
12 |
- id: trailing-whitespace
|
13 |
-
|
14 |
-
|
15 |
-
rev: 5.13.2
|
16 |
-
hooks:
|
17 |
-
- id: isort
|
18 |
-
name: Format imports
|
19 |
-
args: ["--profile", "black"]
|
20 |
-
|
21 |
-
- repo: https://github.com/psf/black
|
22 |
-
rev: 24.10.0
|
23 |
-
hooks:
|
24 |
-
- id: black
|
25 |
-
name: Format code
|
26 |
-
|
27 |
-
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
28 |
-
rev: v0.7.2
|
29 |
hooks:
|
30 |
- id: ruff
|
|
|
|
|
|
|
|
10 |
- id: requirements-txt-fixer
|
11 |
- id: end-of-file-fixer
|
12 |
- id: trailing-whitespace
|
13 |
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
14 |
+
rev: v0.8.4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
hooks:
|
16 |
- id: ruff
|
17 |
+
args: ["--select", "E,F,I,UP,W", "--ignore", "E501", "--fix"]
|
18 |
+
- id: ruff-format
|
19 |
+
args: ["--line-length", "119"]
|
.vscode/settings.json
CHANGED
@@ -2,20 +2,14 @@
|
|
2 |
"editor.formatOnSave": true,
|
3 |
"files.insertFinalNewline": false,
|
4 |
"[python]": {
|
5 |
-
"editor.defaultFormatter": "
|
6 |
"editor.formatOnType": true,
|
7 |
"editor.codeActionsOnSave": {
|
|
|
8 |
"source.organizeImports": "explicit"
|
9 |
}
|
10 |
},
|
11 |
-
"black-formatter.args": [
|
12 |
-
"--line-length=119"
|
13 |
-
],
|
14 |
-
"isort.args": ["--profile", "black"],
|
15 |
"flake8.args": [
|
16 |
"--max-line-length=119"
|
17 |
],
|
18 |
-
"ruff.lint.args": [
|
19 |
-
"--line-length=119"
|
20 |
-
]
|
21 |
}
|
|
|
2 |
"editor.formatOnSave": true,
|
3 |
"files.insertFinalNewline": false,
|
4 |
"[python]": {
|
5 |
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
6 |
"editor.formatOnType": true,
|
7 |
"editor.codeActionsOnSave": {
|
8 |
+
"source.fixAll.ruff": "explicit",
|
9 |
"source.organizeImports": "explicit"
|
10 |
}
|
11 |
},
|
|
|
|
|
|
|
|
|
12 |
"flake8.args": [
|
13 |
"--max-line-length=119"
|
14 |
],
|
|
|
|
|
|
|
15 |
}
|
pyproject.toml
CHANGED
@@ -15,15 +15,27 @@ dependencies = [
|
|
15 |
]
|
16 |
|
17 |
[tool.ruff]
|
18 |
-
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
19 |
-
select = ["E", "F"]
|
20 |
-
ignore = ["E501"] # line too long (black is taking care of this)
|
21 |
line-length = 119
|
22 |
-
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
|
23 |
|
24 |
-
[tool.
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
[tool.
|
29 |
-
|
|
|
15 |
]
|
16 |
|
17 |
[tool.ruff]
|
|
|
|
|
|
|
18 |
line-length = 119
|
|
|
19 |
|
20 |
+
[tool.ruff.lint]
|
21 |
+
select = [
|
22 |
+
"ARG", # Check function argument usage
|
23 |
+
"B", # Common bugs and design problems (from flake8-bugbear)
|
24 |
+
"C", # Complexity checks (from mccabe)
|
25 |
+
"E", # PEP 8 errors (from pycodestyle)
|
26 |
+
"F", # Pyflakes errors (basic Python errors)
|
27 |
+
"I", # Import sorting and formatting
|
28 |
+
"N", # Naming conventions (from pep8-naming)
|
29 |
+
"PL", # Pylint rules
|
30 |
+
"S101", # Use of assert statements (from flake8-bandit)
|
31 |
+
"SIM", # Code simplification suggestions
|
32 |
+
"UP", # Python upgrade suggestions
|
33 |
+
"W", # PEP 8 warnings (from pycodestyle)
|
34 |
+
]
|
35 |
+
ignore = [
|
36 |
+
"E501", # Line too long (> 79 characters)
|
37 |
+
"SIM117", # Use a single 'with' statement with multiple contexts instead of nested 'with' statements
|
38 |
+
]
|
39 |
|
40 |
+
[tool.ruff.format]
|
41 |
+
docstring-code-format = true
|
src/populate.py
CHANGED
@@ -75,7 +75,8 @@ def get_evaluation_queue_df(save_path: str, cols: list[str]) -> list[pd.DataFram
|
|
75 |
|
76 |
# data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
|
77 |
data[EvalQueueColumn.model.name] = make_clickable_model_with_shot(
|
78 |
-
data["model"],
|
|
|
79 |
)
|
80 |
data[EvalQueueColumn.revision.name] = data.get("revision", "main")
|
81 |
|
|
|
75 |
|
76 |
# data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
|
77 |
data[EvalQueueColumn.model.name] = make_clickable_model_with_shot(
|
78 |
+
data["model"],
|
79 |
+
data["num_few_shot"], # num_few_shotは必ず存在するため、直接参照
|
80 |
)
|
81 |
data[EvalQueueColumn.revision.name] = data.get("revision", "main")
|
82 |
|