Skip to content

Commit 8e9390d

Browse files
Backport PR #7132: Adopt ruff format (#7184)
Co-authored-by: Steven Silvester <[email protected]>
1 parent 4d07f1e commit 8e9390d

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

.pre-commit-config.yaml

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.4.0
7+
rev: v4.5.0
88
hooks:
99
- id: check-case-conflict
1010
- id: check-ast
@@ -31,16 +31,11 @@ repos:
3131
- id: blacken-docs
3232
additional_dependencies: [black==23.7.0]
3333

34-
- repo: https://github.com/psf/black-pre-commit-mirror
35-
rev: 23.9.1
36-
hooks:
37-
- id: black
38-
3934
- repo: https://github.com/codespell-project/codespell
4035
rev: 'v2.2.6'
4136
hooks:
4237
- id: codespell
43-
args: ['-L', 'sur,nd']
38+
args: ['-L', 'hart,noteable']
4439
exclude: |
4540
(?x)^(
4641
yarn.lock|
@@ -56,13 +51,14 @@ repos:
5651
- id: rst-inline-touching-normal
5752

5853
- repo: https://github.com/astral-sh/ruff-pre-commit
59-
rev: v0.0.292
54+
rev: v0.1.3
6055
hooks:
6156
- id: ruff
6257
args: ['--fix', '--show-fixes']
58+
- id: ruff-format
6359

6460
- repo: https://github.com/scientific-python/cookie
65-
rev: '2023.09.21'
61+
rev: '2023.10.27'
6662
hooks:
6763
- id: sp-repo-review
6864
additional_dependencies: ['repo-review[cli]']

notebook/app.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ class CustomCssHandler(NotebookBaseHandler):
210210
def get(self) -> t.Any:
211211
"""Get the custom css file."""
212212

213-
self.set_header("Content-Type", 'text/css')
213+
self.set_header("Content-Type", "text/css")
214214
page_config = self.get_page_config()
215215
custom_css_file = f"{page_config['jupyterConfigDir']}/custom/custom.css"
216216

217217
if not os.path.isfile(custom_css_file):
218-
static_path_root = re.match('^(.*?)static', page_config['staticDir'])
218+
static_path_root = re.match("^(.*?)static", page_config["staticDir"])
219219
if static_path_root is not None:
220220
custom_dir = static_path_root.groups()[0]
221221
custom_css_file = f"{custom_dir}custom/custom.css"

pyproject.toml

+8-15
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,20 @@ test = "mypy --install-types --non-interactive {args}"
142142

143143
[tool.hatch.envs.lint]
144144
dependencies = [
145-
"black[jupyter]==22.10.0",
146145
"mdformat>0.7",
147146
"mdformat-gfm>=0.3.5",
148-
"ruff==0.0.276"
147+
"ruff==0.1.3"
149148
]
150149
detached = true
151150
[tool.hatch.envs.lint.scripts]
152151
style = [
153152
"ruff {args:.}",
154-
"black --check --diff {args:.}",
153+
"ruff format {args:.}",
155154
"mdformat --check {args:CHANGELOG.md}"
156155
]
157156
fmt = [
158-
"black {args:.}",
159157
"ruff --fix {args:.}",
158+
"ruff format {args:.}",
160159
"mdformat {args:CHANGELOG.md}"
161160
]
162161

@@ -246,16 +245,13 @@ show_error_codes = true
246245
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
247246
warn_unreachable = true
248247

249-
[tool.black]
250-
line-length = 100
251-
target-version = ["py37"]
252-
skip-string-normalization = true
253-
254248
[tool.ruff]
255-
target-version = "py37"
249+
target-version = "py38"
256250
line-length = 100
251+
252+
[tool.ruff.lint]
257253
select = [
258-
"A", "B", "C", "DTZ", "E", "EM", "F", "FBT", "I", "ICN", "ISC", "N",
254+
"A", "B", "C", "DTZ", "E", "EM", "F", "FBT", "I", "ICN", "N",
259255
"PLC", "PLE", "PLR", "PLW", "Q", "RUF", "S", "SIM", "T", "TID", "UP",
260256
"W", "YTT",
261257
]
@@ -270,7 +266,7 @@ ignore = [
270266
"RUF012",
271267
]
272268

273-
[tool.ruff.per-file-ignores]
269+
[tool.ruff.lint.per-file-ignores]
274270
# S101 Use of `assert` detected
275271
# F841 Local variable `foo` is assigned to but never used
276272
# PLR2004 Magic value used in comparison
@@ -290,6 +286,3 @@ exclude = ["tests", "ui-tests", "docs", "node_modules", "setup.py"]
290286

291287
[tool.repo-review]
292288
ignore = ["PY007", "PP308", "GH102", "PC140", "PC180"]
293-
294-
[tool.codespell]
295-
ignore-words-list = "hart,noteable"

0 commit comments

Comments
 (0)