Skip to content

blacken docs (and other misc) #455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2023
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
7 changes: 5 additions & 2 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
rngs:
# To achieve consistent coverage, we need a little bit of correlated collaboration.
Expand Down Expand Up @@ -248,8 +252,7 @@ jobs:
fi
echo "versions: np${npver} sp${spver} pd${pdver} ak${akver} nx${nxver} numba${numbaver} yaml${yamlver} sparse${sparsever} psgver${psgver}"

# TODO: remove `-c numba` when numba 0.57 is properly released on conda-forge
$(command -v mamba || command -v conda) install -c numba packaging pytest coverage coveralls=3.3.1 pytest-randomly cffi donfig tomli \
$(command -v mamba || command -v conda) install packaging pytest coverage coveralls=3.3.1 pytest-randomly cffi donfig tomli \
pyyaml${yamlver} ${sparse} pandas${pdver} scipy${spver} numpy${npver} ${awkward} \
networkx${nxver} ${numba} ${fmm} ${psg} \
${{ matrix.slowtask == 'pytest_bizarro' && 'black' || '' }} \
Expand Down
28 changes: 20 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
# To update: `pre-commit autoupdate`
# - &flake8_dependencies below needs updated manually
ci:
# See: https://pre-commit.ci/#configuration
autofix_prs: false
autoupdate_schedule: monthly
skip: [pylint, no-commit-to-branch]
# See: https://pre-commit.ci/#configuration
autofix_prs: false
autoupdate_schedule: monthly
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
skip: [pylint, no-commit-to-branch]
fail_fast: true
default_language_version:
python: python3
Expand All @@ -17,15 +19,21 @@ repos:
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-ast
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude_types: [svg]
- id: mixed-line-ending
- id: trailing-whitespace
- id: name-tests-test
args: ["--pytest-test-first"]
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.2
rev: v0.13
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
Expand Down Expand Up @@ -58,7 +66,7 @@ repos:
- id: black
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.267
rev: v0.0.269
hooks:
- id: ruff
args: [--fix-only, --show-fixes]
Expand Down Expand Up @@ -86,7 +94,7 @@ repos:
additional_dependencies: [tomli]
files: ^(graphblas|docs)/
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.267
rev: v0.0.269
hooks:
- id: ruff
- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand All @@ -101,6 +109,10 @@ repos:
hooks:
- id: pyroma
args: [-n, "10", .]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.2"
hooks:
- id: shellcheck
- repo: local
hooks:
# Add `--hook-stage manual` to pre-commit command to run (very slow)
Expand Down Expand Up @@ -137,4 +149,4 @@ repos:
# hooks:
# - id: bandit
#
# blacken-docs, blackdoc mypy, pydocstringformatter, velin, flynt, yamllint
# blacken-docs, blackdoc prettier, mypy, pydocstringformatter, velin, flynt, yamllint
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ use as well as the blocking/non-blocking mode. If the context is not initialized
be performed automatically.
```python
import graphblas as gb

# Context initialization must happen before any other imports
gb.init('suitesparse', blocking=True)
gb.init("suitesparse", blocking=True)

# Now we can import other items from graphblas
from graphblas import binary, semiring
Expand All @@ -195,7 +196,7 @@ def force_odd_func(x):
return x + 1
return x

unary.register_new('force_odd', force_odd_func)
unary.register_new("force_odd", force_odd_func)

v = Vector.from_coo([0, 1, 3], [1, 2, 3])
w = v.apply(unary.force_odd).new()
Expand All @@ -210,7 +211,7 @@ import graphblas as gb

# scipy.sparse matrices
A = gb.io.from_scipy_sparse(m)
m = gb.io.to_scipy_sparse(m, format='csr')
m = gb.io.to_scipy_sparse(m, format="csr")

# networkx graphs
A = gb.io.from_networkx(g)
Expand Down
31 changes: 10 additions & 21 deletions docs/getting_started/primer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,13 @@ makes for faster graph algorithms.

# networkx-style storage of an undirected graph
G = {
0: {1: {'weight': 5.6},
2: {'weight': 2.3},
3: {'weight': 4.6}},
1: {0: {'weight': 5.6},
2: {'weight': 1.9},
3: {'weight': 6.2}},
2: {0: {'weight': 2.3},
1: {'weight': 1.9},
3: {'weight': 3.0}},
3: {0: {'weight': 4.6},
1: {'weight': 6.2},
2: {'weight': 3.0},
4: {'weight': 1.4}},
4: {3: {'weight': 1.4},
5: {'weight': 4.4},
6: {'weight': 1.0}},
5: {4: {'weight': 4.4},
6: {'weight': 2.8}},
6: {4: {'weight': 1.0},
5: {'weight': 2.8}}
0: {1: {"weight": 5.6}, 2: {"weight": 2.3}, 3: {"weight": 4.6}},
1: {0: {"weight": 5.6}, 2: {"weight": 1.9}, 3: {"weight": 6.2}},
2: {0: {"weight": 2.3}, 1: {"weight": 1.9}, 3: {"weight": 3.0}},
3: {0: {"weight": 4.6}, 1: {"weight": 6.2}, 2: {"weight": 3.0}, 4: {"weight": 1.4}},
4: {3: {"weight": 1.4}, 5: {"weight": 4.4}, 6: {"weight": 1.0}},
5: {4: {"weight": 4.4}, 6: {"weight": 2.8}},
6: {4: {"weight": 1.0}, 5: {"weight": 2.8}},
}

An alternative way to store a graph is as an adjacency matrix. Each node becomes both a row
Expand Down Expand Up @@ -240,7 +227,9 @@ node 0.
[0, 0, 1, 1, 2],
[1, 2, 2, 3, 3],
[2.0, 5.0, 1.5, 4.25, 0.5],
nrows=4, ncols=4)
nrows=4,
ncols=4
)
v = Vector.from_coo([start_node], [0.0], size=4)

# Compute SSSP
Expand Down
3 changes: 2 additions & 1 deletion docs/user_guide/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ GraphBLAS must be initialized before it can be used. This is done with the
.. code-block:: python

import graphblas as gb

# Context initialization must happen before any other imports
gb.init('suitesparse', blocking=False)
gb.init("suitesparse", blocking=False)

# Now we can import other items from graphblas
from graphblas import binary, semiring
Expand Down
Loading