Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,11 @@ repos:
exclude: "asdf/(extern||_jsonschema)/.*"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.13.0'
rev: 'v0.15.12'
hooks:
- id: ruff
- id: ruff-check
args: ["--fix"]

- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black

- repo: https://github.com/asottile/blacken-docs
rev: '1.20.0'
hooks:
- id: blacken-docs
- id: ruff-format

- repo: https://github.com/tombi-toml/tombi-pre-commit
rev: v0.9.25
Expand Down
2 changes: 1 addition & 1 deletion asdf/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def render_table(
inner_width = key_width + val_width + 1

# Format each row with key left-aligned and value centered
content = [f"┃ {key:<{key_width-2}} │ {value:^{val_width-2}} ┃" for key, value in rows]
content = [f"┃ {key:<{key_width - 2}} │ {value:^{val_width - 2}} ┃" for key, value in rows]
return [
"┏" + "━" * inner_width + "┓",
f"┃{title:^{inner_width}s}┃", # Centered table title
Expand Down
4 changes: 1 addition & 3 deletions asdf/_tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,7 @@ def test_info_with_custom_extension(capsys):
properties:
bar:
title: bar_title
""".encode(
"ascii"
)
""".encode("ascii")

class MyExtension:
extension_uri = "asdf://somewhere.org/extensions/foo-1.0.0"
Expand Down
4 changes: 3 additions & 1 deletion asdf/_tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def test_make_reference(tmp_path):

ff.write_to(os.path.join(str(tmp_path), "source.asdf"))

with (asdf.open(os.path.join(str(tmp_path), "source.asdf")) as ff,):
with (
asdf.open(os.path.join(str(tmp_path), "source.asdf")) as ff,
):
ff.find_references()
assert ff.tree["ref"]._uri == "external.asdf#f~0o~0o~1/a"

Expand Down
2 changes: 1 addition & 1 deletion asdf/tags/core/external_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ExternalArrayReference:
>>> import asdf
>>> ref = asdf.ExternalArrayReference("myfitsfile.fits", 1, "float64", (100, 100))
>>> tree = {'reference': ref}
>>> tree = {"reference": ref}
>>> with asdf.AsdfFile(tree) as ff:
... ff.write_to("test.asdf")
Expand Down
6 changes: 3 additions & 3 deletions asdf/tags/core/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class IntegerType:
>>> # Store the large integer value to the tree using asdf.IntegerType
>>> tree = dict(largeval=asdf.IntegerType(largeval))
>>> with asdf.AsdfFile(tree) as af:
... af.write_to('largeval.asdf')
>>> with asdf.open('largeval.asdf') as aa:
... assert aa['largeval'] == largeval
... af.write_to("largeval.asdf")
>>> with asdf.open("largeval.asdf") as aa:
... assert aa["largeval"] == largeval
"""

def __init__(self, value, storage_type="internal"):
Expand Down
9 changes: 6 additions & 3 deletions integration_tests/compatibility/test_file_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ def test_file_compatibility(asdf_version, env_path, tmp_path):
str(standard_version),
capture_output=True,
), f"asdf library version {asdf_version} failed to generate an ASDF Standard {standard_version} file"
assert_file_correct(old_file_path), (
f"asdf library version {asdf_version} produced an ASDF Standard {standard_version}"
"that this code failed to read"
(
assert_file_correct(old_file_path),
(
f"asdf library version {asdf_version} produced an ASDF Standard {standard_version}"
"that this code failed to read"
),
)
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ target-version = "py310"
line-length = 120
extend-exclude = ["asdf/_extern/*", "asdf/_jsonschema/*", "docs/*"]

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88

[tool.ruff.lint]
future-annotations = true
select = [
Expand Down
Loading