Skip to content

Use double (not single) backtick in docstrings #454

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 14, 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
8 changes: 4 additions & 4 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,22 @@ jobs:
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", "=1.24", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", "=2.0", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", "=2.2", ""]))')
elif [[ ${{ startsWith(steps.pyver.outputs.selected, '3.9') }} == true ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", "=1.24", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", "=2.0", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", "=2.2", ""]))')
elif [[ ${{ startsWith(steps.pyver.outputs.selected, '3.10') }} == true ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", "=1.24", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.3", "=1.4", "=1.5", "=2.0", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", "=2.2", ""]))')
else # Python 3.11
npver=$(python -c 'import random ; print(random.choice(["=1.23", "=1.24", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.5", "=2.0", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.10", "=2.0", "=2.1", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.10", "=2.0", "=2.1", "=2.2", ""]))')
fi
if [[ ${{ steps.sourcetype.outputs.selected }} == "source" || ${{ steps.sourcetype.outputs.selected }} == "upstream" ]]; then
# TODO: there are currently issues with some numpy versions when
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- id: isort
# Let's keep `pyupgrade` even though `ruff --fix` probably does most of it
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.2
rev: v3.4.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -58,7 +58,7 @@ repos:
- id: black
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
rev: v0.0.267
hooks:
- id: ruff
args: [--fix-only, --show-fixes]
Expand All @@ -71,7 +71,7 @@ repos:
additional_dependencies: &flake8_dependencies
# These versions need updated manually
- flake8==6.0.0
- flake8-bugbear==23.3.23
- flake8-bugbear==23.5.9
- flake8-simplify==0.20.0
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
Expand All @@ -86,7 +86,7 @@ repos:
additional_dependencies: [tomli]
files: ^(graphblas|docs)/
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
rev: v0.0.267
hooks:
- id: ruff
- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ dependencies:
# - python-igraph
# - python-louvain
# - pyupgrade
# - rich
# - ruff
# - scalene
# - scikit-network
# - setuptools-git-versioning
# - snakeviz
# - sphinx-lint
Expand Down
8 changes: 4 additions & 4 deletions graphblas/agg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""`graphblas.agg` is an experimental module for exploring Aggregators.
"""``graphblas.agg`` is an experimental module for exploring Aggregators.

Aggregators may be used in reduce methods:
- Matrix.reduce_rowwise
Expand Down Expand Up @@ -59,9 +59,9 @@
- ss.argmax

.. deprecated:: 2023.1.0
Aggregators `first`, `last`, `first_index`, `last_index`, `argmin`, and `argmax` are
deprecated in the `agg` namespace such as `agg.first`. Use them from `agg.ss` namespace
instead such as `agg.ss.first`. Will be removed in version 2023.9.0 or later.
Aggregators ``first``, ``last``, ``first_index``, ``last_index``, ``argmin``, and ``argmax``
are deprecated in the ``agg`` namespace such as ``agg.first``. Use them from ``agg.ss``
namespace instead such as ``agg.ss.first``. Will be removed in version 2023.9.0 or later.

# Possible aggregators:
# - absolute_deviation, sum(abs(x - mean(x))), sum_absminus(x, mean(x))
Expand Down
4 changes: 2 additions & 2 deletions graphblas/core/agg.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""graphblas.core.agg namespace is deprecated; please use graphblas.core.operator.agg instead.

.. deprecated:: 2023.3.0
`graphblas.core.agg` will be removed in a future release.
Use `graphblas.core.operator.agg` instead.
``graphblas.core.agg`` will be removed in a future release.
Use ``graphblas.core.operator.agg`` instead.
Will be removed in version 2023.11.0 or later.

"""
Expand Down
2 changes: 1 addition & 1 deletion graphblas/core/automethods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Define functions to use as property methods on expressions.

These will automatically compute the value and avoid the need for `.new()`.
These will automatically compute the value and avoid the need for ``.new()``.

To automatically create the functions, run:

Expand Down
10 changes: 5 additions & 5 deletions graphblas/core/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def new(self, dtype=None, *, complement=False, mask=None, name=None, **opts):
"""Return a new object with True values determined by the mask(s).

By default, the result is True wherever the mask(s) would have been applied,
and empty otherwise. If `complement` is True, then these are switched:
and empty otherwise. If ``complement`` is True, then these are switched:
the result is empty where the mask(s) would have been applied, and True otherwise.

In other words, these are equivalent if complement is False (and mask keyword is None):
Expand All @@ -48,14 +48,14 @@ def new(self, dtype=None, *, complement=False, mask=None, name=None, **opts):
>>> C(self) << expr
>>> C(~result.S) << expr # equivalent when complement is True

This can also efficiently merge two masks by using the `mask=` argument.
This can also efficiently merge two masks by using the ``mask=`` argument.
This is equivalent to the following (but uses more efficient recipes):

>>> val = Matrix(...)
>>> val(self) << True
>>> val(mask, replace=True) << val

If `complement=` argument is True, then the *complement* will be returned.
If ``complement=`` argument is True, then the *complement* will be returned.
This is equivalent to the following (but uses more efficient recipes):

>>> val = Matrix(...)
Expand Down Expand Up @@ -83,7 +83,7 @@ def new(self, dtype=None, *, complement=False, mask=None, name=None, **opts):
def __and__(self, other, **opts):
"""Return the intersection of two masks as a new mask.

`new_mask = mask1 & mask2` is equivalent to the following:
``new_mask = mask1 & mask2`` is equivalent to the following:

>>> val = Matrix(bool, nrows, ncols)
>>> val(mask1) << True
Expand All @@ -109,7 +109,7 @@ def __and__(self, other, **opts):
def __or__(self, other, **opts):
"""Return the union of two masks as a new mask.

`new_mask = mask1 | mask2` is equivalent to the following:
``new_mask = mask1 | mask2`` is equivalent to the following:

>>> val = Matrix(bool, nrows, ncols)
>>> val(mask1) << True
Expand Down
30 changes: 15 additions & 15 deletions graphblas/core/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def isclose(self, other, *, rel_tol=1e-7, abs_tol=0.0, check_dtype=False, **opts
Returns
-------
bool
Whether all values of the Matrix are close to the values in `other`.
Whether all values of the Matrix are close to the values in ``other``.
"""
other = self._expect_type(
other, (Matrix, TransposedMatrix), within="isclose", argname="other"
Expand Down Expand Up @@ -448,19 +448,19 @@ def to_values(self, dtype=None, *, rows=True, columns=True, values=True, sort=Tr
corresponding to the COO format of the Matrix.

.. deprecated:: 2022.11.0
`Matrix.to_values` will be removed in a future release.
Use `Matrix.to_coo` instead. Will be removed in version 2023.9.0 or later
``Matrix.to_values`` will be removed in a future release.
Use ``Matrix.to_coo`` instead. Will be removed in version 2023.9.0 or later

Parameters
----------
dtype :
Requested dtype for the output values array.
rows : bool, default=True
Whether to return rows; will return `None` for rows if `False`
Whether to return rows; will return ``None`` for rows if ``False``
columns :bool, default=True
Whether to return columns; will return `None` for columns if `False`
Whether to return columns; will return ``None`` for columns if ``False``
values : bool, default=True
Whether to return values; will return `None` for values if `False`
Whether to return values; will return ``None`` for values if ``False``
sort : bool, default=True
Whether to require sorted indices.
If internally stored rowwise, the sorting will be first by rows, then by column.
Expand Down Expand Up @@ -488,11 +488,11 @@ def to_coo(self, dtype=None, *, rows=True, columns=True, values=True, sort=True)
dtype :
Requested dtype for the output values array.
rows : bool, default=True
Whether to return rows; will return `None` for rows if `False`
Whether to return rows; will return ``None`` for rows if ``False``
columns :bool, default=True
Whether to return columns; will return `None` for columns if `False`
Whether to return columns; will return ``None`` for columns if ``False``
values : bool, default=True
Whether to return values; will return `None` for values if `False`
Whether to return values; will return ``None`` for values if ``False``
sort : bool, default=True
Whether to require sorted indices.
If internally stored rowwise, the sorting will be first by rows, then by column.
Expand Down Expand Up @@ -559,7 +559,7 @@ def to_edgelist(self, dtype=None, *, values=True, sort=True):
dtype :
Requested dtype for the output values array.
values : bool, default=True
Whether to return values; will return `None` for values if `False`
Whether to return values; will return ``None`` for values if ``False``
sort : bool, default=True
Whether to require sorted indices.
If internally stored rowwise, the sorting will be first by rows, then by column.
Expand All @@ -585,7 +585,7 @@ def build(self, rows, columns, values, *, dup_op=None, clear=False, nrows=None,
The typical use case is to create a new Matrix and insert values
at the same time using :meth:`from_coo`.

All the arguments are used identically in :meth:`from_coo`, except for `clear`, which
All the arguments are used identically in :meth:`from_coo`, except for ``clear``, which
indicates whether to clear the Matrix prior to adding the new values.
"""
# TODO: accept `dtype` keyword to match the dtype of `values`?
Expand Down Expand Up @@ -781,8 +781,8 @@ def from_values(
"""Create a new Matrix from row and column indices and values.

.. deprecated:: 2022.11.0
`Matrix.from_values` will be removed in a future release.
Use `Matrix.from_coo` instead. Will be removed in version 2023.9.0 or later
``Matrix.from_values`` will be removed in a future release.
Use ``Matrix.from_coo`` instead. Will be removed in version 2023.9.0 or later

Parameters
----------
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def from_csr(
Parameters
----------
indptr : list or np.ndarray
Pointers for each row into col_indices and values; `indptr.size == nrows + 1`.
Pointers for each row into col_indices and values; ``indptr.size == nrows + 1``.
col_indices : list or np.ndarray
Column indices.
values : list or np.ndarray or scalar, default 1.0
Expand Down Expand Up @@ -1133,7 +1133,7 @@ def from_csc(
Parameters
----------
indptr : list or np.ndarray
Pointers for each column into row_indices and values; `indptr.size == ncols + 1`.
Pointers for each column into row_indices and values; ``indptr.size == ncols + 1``.
col_indices : list or np.ndarray
Column indices.
values : list or np.ndarray or scalar, default 1.0
Expand Down
2 changes: 1 addition & 1 deletion graphblas/core/operator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def _find(cls, funcname):
def _initialize(cls, include_in_ops=True):
"""
include_in_ops determines whether the operators are included in the
`gb.ops` namespace in addition to the defined module.
``gb.ops`` namespace in addition to the defined module.
"""
if cls._initialized: # pragma: no cover (safety)
return
Expand Down
2 changes: 1 addition & 1 deletion graphblas/core/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def gbstr(arg):
class Recorder:
"""Record GraphBLAS C calls.

The recorder can use `.start()` and `.stop()` to enable/disable recording,
The recorder can use ``.start()`` and ``.stop()`` to enable/disable recording,
or it can be used as a context manager.

For example,
Expand Down
2 changes: 1 addition & 1 deletion graphblas/core/scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ def _as_scalar(scalar, dtype=None, *, is_cscalar):


def _dict_to_record(np_type, d):
"""Converts e.g. `{"x": 1, "y": 2.3}` to `(1, 2.3)`."""
"""Converts e.g. ``{"x": 1, "y": 2.3}`` to ``(1, 2.3)``."""
rv = []
for name, (dtype, _) in np_type.fields.items():
val = d[name]
Expand Down
2 changes: 1 addition & 1 deletion graphblas/core/ss/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get_descriptor(**opts):
sort : bool, default False
A hint for whether methods may return a "jumbled" matrix
secure_import : bool, default False
Whether to trust the data for `import` and `pack` functions.
Whether to trust the data for ``import`` and ``pack`` functions.
When True, checks are performed to ensure input data is valid.
compression : str, {"none", "default", "lz4", "lz4hc", "zstd"}
Whether and how to compress the data for serialization.
Expand Down
Loading