Skip to content

Commit

Permalink
chore(deps): bump flake8 (#358)
Browse files Browse the repository at this point in the history
* chore(deps): bump flake8

* fix: flake8 warnings
  • Loading branch information
mbrobbel authored Jan 8, 2025
1 parent aecff0e commit c36d3f4
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: python3 -m pip install --upgrade pip black==22.3.0 flake8==4.0.1
run: python3 -m pip install --upgrade pip black==22.3.0 flake8==7.1.1
- name: Black
run: python3 -m black --diff --check .
- name: Flake8
Expand Down
66 changes: 33 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: clippy
- id: cargo-check
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
types_or: [c, c++]
- repo: https://github.com/nametake/pre-commit-buf
rev: v2.0.0
hooks:
- id: buf-lint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [-c=.yamllint.yaml]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
hooks:
- id: commitlint
stages: [commit-msg]
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: clippy
- id: cargo-check
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
types_or: [c, c++]
- repo: https://github.com/nametake/pre-commit-buf
rev: v2.0.0
hooks:
- id: buf-lint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [-c=.yamllint.yaml]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
hooks:
- id: commitlint
stages: [commit-msg]
40 changes: 20 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Contributions are welcome! Here are some ways you can help:

- Try to break it. Get it to emit an error or warning for something you believe to be completely valid, or get it to emit nothing or only a warning for something you believe to be invalid. The validator is currently still considered to be experimental.
- Help with reviewing PRs and keeping up with Substrait.
- Improve the built-in plan documentation. The validator tries to emit plain English descriptions of various nodes in the tree to explain what they do, but this is far from complete.
- Submit additional integration tests, for more and better queries. Currently about half of TPC-H exists, but the quality of the plans is very poor (no optimization, partially handwritten, may be wholly incorrect, mostly restricted to the set of things Isthmus generates).
- Look through the issues to see if anything needs solving.
- Or maybe we're missing something we haven't even thought of yet!
- Try to break it. Get it to emit an error or warning for something you believe to be completely valid, or get it to emit nothing or only a warning for something you believe to be invalid. The validator is currently still considered to be experimental.
- Help with reviewing PRs and keeping up with Substrait.
- Improve the built-in plan documentation. The validator tries to emit plain English descriptions of various nodes in the tree to explain what they do, but this is far from complete.
- Submit additional integration tests, for more and better queries. Currently about half of TPC-H exists, but the quality of the plans is very poor (no optimization, partially handwritten, may be wholly incorrect, mostly restricted to the set of things Isthmus generates).
- Look through the issues to see if anything needs solving.
- Or maybe we're missing something we haven't even thought of yet!

## Licensing

Expand All @@ -17,27 +17,27 @@ All contributions should be licensed under Apache 2.0. We use SPDX license heade

Here's a (probably non-exhaustive) list of things you may want to have installed to develop for the validator.

- [Rust stable](https://rustup.rs/)
- VSCode with [rust-analyzer](https://rust-analyzer.github.io/) (or some other IDE with Rust support)
- Python 3.x (all non-EOL versions should be supported)
- The toolchain should be able to compile libprotobuf for you if you don't already have it, but it's probably a good idea to have a reasonably recent version installed system-wide as well
- [pre-commit](https://pre-commit.com/), so you don't have to rely on CI to catch all your errors, and to help format your code
- git (obviously)
- for the C bindings: [CMake](https://cmake.org/) and a C compiler (gcc, clang, and MSVC should all work; the bindings are very lightweight)
- [Protobuf](https://protobuf.dev/overview/), namely the `protoc` executable, for working with Substrait
- [Rust stable](https://rustup.rs/)
- VSCode with [rust-analyzer](https://rust-analyzer.github.io/) (or some other IDE with Rust support)
- Python 3.x (all non-EOL versions should be supported)
- The toolchain should be able to compile libprotobuf for you if you don't already have it, but it's probably a good idea to have a reasonably recent version installed system-wide as well
- [pre-commit](https://pre-commit.com/), so you don't have to rely on CI to catch all your errors, and to help format your code
- git (obviously)
- for the C bindings: [CMake](https://cmake.org/) and a C compiler (gcc, clang, and MSVC should all work; the bindings are very lightweight)
- [Protobuf](https://protobuf.dev/overview/), namely the `protoc` executable, for working with Substrait

Note: this list is probably non-exhaustive; if you find something missing from this list, please add it!

## Code style

Code style is strictly enforced for all languages using CI and (to some extent) [pre-commit](https://pre-commit.com/) via:

- Rust: [rustfmt](https://github.com/rust-lang/rustfmt) and [clippy](https://github.com/rust-lang/rust-clippy).
- At the time of writing, stable clippy (1.60 and 1.61) panics on the codebase; hopefully this will be fixed soon. In CI the toolchain for linting is pinned to 1.59 for this reason. You can use Rust 1.59 to run clippy locally as well (`rustup install 1.59.0`, `cargo +1.59.0 clippy`) or you can leave it to CI, but either way you'll have to silence pre-commit (run it, see if there are no violations other than the clippy panic, then commit using `--no-verify`).
- Python: [black](https://github.com/psf/black) and [flake8](https://flake8.pycqa.org/en/4.0.1/).
- C: [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
- protobuf: [buf format](https://buf.build/blog/introducing-buf-format).
- YAML: [yamllint](https://github.com/adrienverge/yamllint).
- Rust: [rustfmt](https://github.com/rust-lang/rustfmt) and [clippy](https://github.com/rust-lang/rust-clippy).
- At the time of writing, stable clippy (1.60 and 1.61) panics on the codebase; hopefully this will be fixed soon. In CI the toolchain for linting is pinned to 1.59 for this reason. You can use Rust 1.59 to run clippy locally as well (`rustup install 1.59.0`, `cargo +1.59.0 clippy`) or you can leave it to CI, but either way you'll have to silence pre-commit (run it, see if there are no violations other than the clippy panic, then commit using `--no-verify`).
- Python: [black](https://github.com/psf/black) and [flake8](https://flake8.pycqa.org/en/7.1.1/).
- C: [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
- protobuf: [buf format](https://buf.build/blog/introducing-buf-format).
- YAML: [yamllint](https://github.com/adrienverge/yamllint).

## Commit conventions

Expand Down
6 changes: 3 additions & 3 deletions ci/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def escape(s):
frm = line[1:]
if not lines[index + 1].startswith("+"):
print(
f"Error: expecting -+ line pairs on lines {index+1} "
f"and {index+2} of `git diff`"
f"Error: expecting -+ line pairs on lines {index + 1} "
f"and {index + 2} of `git diff`"
)
sys.exit(1)
to = lines[index + 1][1:]
Expand All @@ -124,7 +124,7 @@ def escape(s):
or to.replace(dummy_version, current_version) != frm
):
print(
f"Error: diff at lines {index+1} and {index+2} of git "
f"Error: diff at lines {index + 1} and {index + 2} of git "
f"diff is not just a change from {current_version} to "
f"{dummy_version}"
)
Expand Down
12 changes: 6 additions & 6 deletions py/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ def test_proto_roundtrip():
def test_parsing():
"""Test the parsing function."""
result = sv.plan_to_parse_result(BASIC_PLAN)
assert type(result) == sv.ParseResult
assert isinstance(result, sv.ParseResult)

root = sv.parse_plan(BASIC_PLAN)
assert type(root) == sv.ParseResult
assert isinstance(root, sv.ParseResult)

root = sv.plan_to_parse_result(BASIC_PLAN)
assert type(root) == sv.ParseResult
assert isinstance(root, sv.ParseResult)


def test_export_html():
"""Test the HTML export function."""
html = sv.plan_to_html(BASIC_PLAN)
assert type(html) == str
assert isinstance(html, str)
lines = list(filter(bool, html.split("\n")))
assert lines[0] == "<!DOCTYPE html>"
assert lines[-1] == "</html>"
Expand All @@ -72,11 +72,11 @@ def test_export_html():
def test_export_diags():
"""Test the diagnostics export functions."""
diags = sv.plan_to_diagnostics_str(BASIC_PLAN)
assert type(diags) == str
assert isinstance(diags, str)

diags = list(sv.plan_to_diagnostics(BASIC_PLAN))
for diag in diags:
assert type(diag) == sv.Diagnostic
assert isinstance(diag, sv.Diagnostic)


def test_valid_invalid():
Expand Down

0 comments on commit c36d3f4

Please sign in to comment.