diff --git a/asdf/_convenience.py b/asdf/_convenience.py index b21326c31..ea06bd981 100644 --- a/asdf/_convenience.py +++ b/asdf/_convenience.py @@ -41,7 +41,7 @@ def info(node_or_path, max_rows=DEFAULT_MAX_ROWS, max_cols=DEFAULT_MAX_COLS, sho """ with _manage_node(node_or_path) as node: lines = render_tree(node, max_rows=max_rows, max_cols=max_cols, show_values=show_values, identifier="root") - print("\n".join(lines)) # noqa: T201 + print("\n".join(lines)) @contextmanager diff --git a/asdf/asdf.py b/asdf/asdf.py index 6ff098161..3b8fa24a3 100644 --- a/asdf/asdf.py +++ b/asdf/asdf.py @@ -1657,7 +1657,7 @@ def info( identifier="root", refresh_extension_manager=refresh_extension_manager, ) - print("\n".join(lines)) # noqa: T201 + print("\n".join(lines)) def search(self, key=NotSet, type_=NotSet, value=NotSet, filter_=None): """ diff --git a/asdf/commands/edit.py b/asdf/commands/edit.py index af8459366..89c356658 100644 --- a/asdf/commands/edit.py +++ b/asdf/commands/edit.py @@ -191,7 +191,7 @@ def edit(path): # Extract the YAML portion of the original file: with generic_io.get_file(path, mode="r") as fd: if fd.peek(len(constants.ASDF_MAGIC)) != constants.ASDF_MAGIC: - print(f"Error: '{path}' is not an ASDF file.") # noqa: T201 + print(f"Error: '{path}' is not an ASDF file.") return 1 original_content, available_bytes, contains_blocks = read_yaml(fd) @@ -217,14 +217,14 @@ def edit(path): new_content = f.read() if new_content == original_content: - print("No changes made to file") # noqa: T201 + print("No changes made to file") return 0 try: new_asdf_version = parse_asdf_version(new_content) new_yaml_version = parse_yaml_version(new_content) except Exception as e: # noqa: BLE001 - print(f"Error: failed to parse ASDF header: {str(e)}") # noqa: T201 + print(f"Error: failed to parse ASDF header: {str(e)}") choice = request_input("(c)ontinue editing or (a)bort? ", ["c", "a"]) if choice == "a": return 1 @@ -232,7 +232,7 @@ def edit(path): continue if new_asdf_version != original_asdf_version or new_yaml_version != original_yaml_version: - print("Error: cannot modify ASDF Standard or YAML version using this tool.") # noqa: T201 + print("Error: cannot modify ASDF Standard or YAML version using this tool.") choice = request_input("(c)ontinue editing or (a)bort? ", ["c", "a"]) if choice == "a": return 1 @@ -246,7 +246,7 @@ def edit(path): with open_asdf(io.BytesIO(new_content), _force_raw_types=True): pass except yaml.YAMLError as e: - print("Error: failed to parse updated YAML:") # noqa: T201 + print("Error: failed to parse updated YAML:") print_exception(e) choice = request_input("(c)ontinue editing or (a)bort? ", ["c", "a"]) if choice == "a": @@ -255,7 +255,7 @@ def edit(path): continue except schema.ValidationError as e: - print("Warning: updated ASDF tree failed validation:") # noqa: T201 + print("Warning: updated ASDF tree failed validation:") print_exception(e) choice = request_input("(c)ontinue editing, (f)orce update, or (a)bort? ", ["c", "f", "a"]) if choice == "a": @@ -265,7 +265,7 @@ def edit(path): continue except Exception as e: # noqa: BLE001 - print("Error: failed to read updated file as ASDF:") # noqa: T201 + print("Error: failed to read updated file as ASDF:") print_exception(e) choice = request_input("(c)ontinue editing or (a)bort? ", ["c", "a"]) if choice == "a": @@ -291,7 +291,7 @@ def edit(path): else: # File does not have sufficient space, and binary blocks # are present. - print("Warning: updated YAML larger than allocated space. File must be rewritten.") # noqa: T201 + print("Warning: updated YAML larger than allocated space. File must be rewritten.") choice = request_input("(c)ontinue or (a)bort? ", ["c", "a"]) if choice == "a": return 1 @@ -346,7 +346,7 @@ def print_exception(e): if len(lines) > 20: lines = lines[0:20] + ["..."] for line in lines: - print(f" {line}") # noqa: T201 + print(f" {line}") def request_input(message, choices): @@ -366,7 +366,7 @@ def request_input(message, choices): if choice in choices: return choice - print(f"Invalid choice: {choice}") # noqa: T201 + print(f"Invalid choice: {choice}") return None diff --git a/asdf/commands/extension.py b/asdf/commands/extension.py index 0ec9759b8..cc0d0e05e 100644 --- a/asdf/commands/extension.py +++ b/asdf/commands/extension.py @@ -64,9 +64,9 @@ def _print_extension_details(ext, tags_only): tag_uris.append(typ.make_yaml_tag(typ.name)) if len(tag_uris) > 0: - print("tags:") # noqa: T201 + print("tags:") for tag_uri in sorted(tag_uris): - print(f" - {tag_uri}") # noqa: T201 + print(f" - {tag_uri}") if not tags_only: types = [] @@ -77,14 +77,14 @@ def _print_extension_details(ext, tags_only): types.extend(typ.types) if len(types) > 0: - print("types:") # noqa: T201 + print("types:") for typ in sorted(types, key=_format_type_name): - print(f" - {_format_type_name(typ)}") # noqa: T201 + print(f" - {_format_type_name(typ)}") def find_extensions(summary, tags_only): for ext in get_extensions(): - print(_format_extension(ext)) # noqa: T201 + print(_format_extension(ext)) if not summary: _print_extension_details(ext, tags_only) - print() # noqa: T201 + print() diff --git a/pyproject.toml b/pyproject.toml index dd25692a8..c580aed8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,29 +162,16 @@ exclude_lines = [ [tool.ruff] target-version = "py38" line-length = 120 -select = ["ALL"] +select = [ + # minimal set to match pre-ruff behavior + "E", # pycodestyle + "F", # pyflakes, autoflake + "I", # isort + "S", # bandit + "UP", # pyupgrade + "RUF", # ruff specific, includes yesqa +] extend-ignore = [ - # Ignored check groups - "C90", # mccabe complexity - "D", # pydocstyle - "ANN", # flake8-annotations - "FBT", # flake8-boolean-trap - "ARG", # flake8-unused-arguments - "DTZ", # flake8-datetimez - "PTH", # flake8-use-pathlib - # Individually ignored checks - "B028", # No explicit stacklevel argument - "PIE810", # Call `startswith` once with a `tuple` - "PLC1901", # compare-to-empty-string - "PLR0911", # Too many return statements - "PLR0912", # Too many branches - "PLR0913", # Too many arguments to function call - "PLR0915", # Too many statements - "PLR2004", # Magic value used in comparison - "SLF001", # Private member accessed - "TRY002", # Create your own exception - "TRY301", # Abstract raise to an inner function - "TRY400", # Use logging.exception instead of logging.error "S310", # URL open for permitted schemes ] extend-exclude = ["asdf/extern/*", "docs/*"] diff --git a/pytest_asdf/plugin.py b/pytest_asdf/plugin.py index bcdbfd64a..c4a94241c 100644 --- a/pytest_asdf/plugin.py +++ b/pytest_asdf/plugin.py @@ -254,7 +254,7 @@ def runtest(self): ff._open_impl(ff, buff, mode="rw") except Exception: - print(f"Example: {self.example.description}\n From file: {self.filename}") # noqa: T201 + print(f"Example: {self.example.description}\n From file: {self.filename}") raise # Just test we can write it out. A roundtrip test