Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#582)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.2 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.2...v0.9.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 13, 2025
1 parent c80fe54 commit 581c9e7
Show file tree
Hide file tree
Showing 17 changed files with 305 additions and 309 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ A clear and concise description of what you expected to happen.

**System**

- OS: [e.g. Windows 10]
- Python version [e.g. 3.9]
- Versions of libraries involved [e.g. AnnData 0.8.0, Scirpy 0.12.0]
- OS: [e.g. Windows 10]
- Python version [e.g. 3.9]
- Versions of libraries involved [e.g. AnnData 0.8.0, Scirpy 0.12.0]

**Additional context**
Add any other context about the problem here.
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Closes #...

- [ ] CHANGELOG.md updated
- [ ] Tests added (For bug fixes or new features)
- [ ] Tutorial updated (if necessary)
- [ ] CHANGELOG.md updated
- [ ] Tests added (For bug fixes or new features)
- [ ] Tutorial updated (if necessary)
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: prettier
exclude: '^\.conda'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.9.1
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
528 changes: 264 additions & 264 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Please consider making a tax-deductible [donation](https://numfocus.org/donate-t

Please refer to the [documentation][link-docs]. In particular, the

- [Tutorial][link-tutorial], and the
- [API documentation][link-api].
- [Tutorial][link-tutorial], and the
- [API documentation][link-api].

## Installation

Expand Down Expand Up @@ -88,8 +88,8 @@ See the [changelog][changelog].

We are happy to assist with problems when using scirpy.

- If you need help with scirpy or have questions regarding single-cell immune-cell receptor analysis in general, please join us in the [scverse discourse][scverse-discourse].
- For bug report or feature requests, please use the [issue tracker][issue-tracker].
- If you need help with scirpy or have questions regarding single-cell immune-cell receptor analysis in general, please join us in the [scverse discourse][scverse-discourse].
- For bug report or feature requests, please use the [issue tracker][issue-tracker].

We try to respond within two working days, however fixing bugs or implementing new features
can take substantially longer, depending on the availability of our developers.
Expand Down
18 changes: 9 additions & 9 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ Scirpy uses [hatch-vcs](https://github.com/ofek/hatch-vcs) to automaticlly retri

Please write documentation for new or changed features and use-cases. This project uses [sphinx][] with the following features:

- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text
- [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension).
- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
- [Sphinx autodoc typehints][], to automatically reference annotated input and output types
- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/)
- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text
- [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension).
- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
- [Sphinx autodoc typehints][], to automatically reference annotated input and output types
- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/)

See the [scanpy developer docs](https://scanpy.readthedocs.io/en/latest/dev/documentation.html) for more information
on how to write documentation.
Expand All @@ -111,10 +111,10 @@ repository.

#### Hints

- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only
if you do so can sphinx automatically create a link to the external documentation.
- If building the documentation fails because of a missing link that is outside your control, you can add an entry to
the `nitpick_ignore` list in `docs/conf.py`
- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only
if you do so can sphinx automatically create a link to the external documentation.
- If building the documentation fails because of a missing link that is outside your control, you can add an entry to
the `nitpick_ignore` list in `docs/conf.py`

#### Building the docs locally

Expand Down
2 changes: 1 addition & 1 deletion docs/extensions/typed_returns.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def _process_return(lines: Iterable[str]) -> Generator[str, None, None]:
for line in lines:
if m := re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line):
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
yield f"-{m['param']} (:class:`~{m['type']}`)"
else:
yield line

Expand Down
4 changes: 2 additions & 2 deletions src/scirpy/io/_tracerlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ def get_summary(self):
if not self.has_D_segment:
V_segment = self.summary[0]
J_segment = self.summary[1]
segments_string = f"V segment:\t{V_segment}\n" f"J segment:\t{J_segment}\n"
segments_string = f"V segment:\t{V_segment}\nJ segment:\t{J_segment}\n"
else:
V_segment = self.summary[0]
D_segment = self.summary[1]
J_segment = self.summary[2]
segments_string = f"V segment:\t{V_segment}\nD segment:\t{D_segment}\n" f"J segment:\t{J_segment}\n"
segments_string = f"V segment:\t{V_segment}\nD segment:\t{D_segment}\nJ segment:\t{J_segment}\n"
summary_string += segments_string
summary_string += f"ID:\t{self.identifier}\n"
summary_string += (
Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/ir_dist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def TcrNeighbors(*args, **kwargs):

def IrNeighbors(*args, **kwargs):
raise RuntimeError(
"IrNeighbors has been removed in v0.7.0. Use either `ir_dist` " "or `sequence_dist` for that functionality. "
"IrNeighbors has been removed in v0.7.0. Use either `ir_dist` or `sequence_dist` for that functionality. "
)


Expand Down
10 changes: 5 additions & 5 deletions src/scirpy/ir_dist/_clonotype_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def _make_clonotype_table(self, params: DataHandler) -> tuple[Mapping, pd.DataFr
for tmp_arm in self._receptor_arm_cols:
primary_is_nan = clonotypes[f"{tmp_arm}_1_{self.sequence_key}"] == "nan"
secondary_is_nan = clonotypes[f"{tmp_arm}_2_{self.sequence_key}"] == "nan"
assert not np.sum(
~secondary_is_nan[primary_is_nan]
), "There must not be a secondary chain if there is no primary one"
assert not np.sum(~secondary_is_nan[primary_is_nan]), (
"There must not be a secondary chain if there is no primary one"
)

return cell_indices, clonotypes

Expand Down Expand Up @@ -327,7 +327,7 @@ def AND_max(a, b):
distance_matrix_name, forward, _ = self.neighbor_finder.lookups["match_columns"]
distance_matrix_name_reverse, _, reverse = self.neighbor_finder.lookups["match_columns"]
if distance_matrix_name != distance_matrix_name_reverse:
raise ValueError("Forward and reverse lookup tablese must be defined " "on the same distance matrices.")
raise ValueError("Forward and reverse lookup tablese must be defined on the same distance matrices.")
reverse_lookup_values = np.vstack(list(reverse.lookup.values()))
reverse_lookup_keys = np.zeros(reverse.size, dtype=np.int64)
reverse_lookup_keys[list(reverse.lookup.keys())] = np.arange(len(list(reverse.lookup.keys())))
Expand Down Expand Up @@ -416,7 +416,7 @@ def match_gene_segment(
distance_matrix_name, forward, _ = self.neighbor_finder.lookups[f"{tmp_arm}_{c1}_{segment_suffix}"]
distance_matrix_name_reverse, _, reverse = self.neighbor_finder.lookups[f"{tmp_arm}_{c2}_{segment_suffix}"]
if distance_matrix_name != distance_matrix_name_reverse:
raise ValueError("Forward and reverse lookup tablese must be defined " "on the same distance matrices.")
raise ValueError("Forward and reverse lookup tablese must be defined on the same distance matrices.")
empty_row = np.array([np.zeros(reverse.size, dtype=bool)])
reverse_lookup_values = np.vstack((*reverse.lookup.values(), empty_row))
reverse_lookup_keys = np.full(id_len, -1, dtype=np.int32)
Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/ir_dist/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def lookup(
if reverse_lookup_table_name is not None:
distance_matrix_name_reverse, _, reverse_lookup_table = self.lookups[reverse_lookup_table_name]
if distance_matrix_name != distance_matrix_name_reverse:
raise ValueError("Forward and reverse lookup tablese must be defined " "on the same distance matrices.")
raise ValueError("Forward and reverse lookup tablese must be defined on the same distance matrices.")

distance_matrix = self.distance_matrices[distance_matrix_name]

Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/pl/_clonotype_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def clonotype_imbalance(
params = DataHandler(adata, airr_mod)
if key_added not in params.adata.uns:
sc.logging.warning(
"Clonotype imbalance not found." " Running `ir.tl.clonotype_imbalance` and storing under {key_added}"
"Clonotype imbalance not found. Running `ir.tl.clonotype_imbalance` and storing under {key_added}"
)

tl.clonotype_imbalance(
Expand Down
4 changes: 1 addition & 3 deletions src/scirpy/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ def test_layout_components(arrange_boxes, component_layout):
try:
layout_components(g, arrange_boxes=arrange_boxes, component_layout=component_layout)
except ImportError:
warnings.warn(
f"The '{component_layout}' layout-test was skipped because rectangle " "packer is not installed. "
)
warnings.warn(f"The '{component_layout}' layout-test was skipped because rectangle packer is not installed. ")


def test_translate_dna_to_protein(adata_tra):
Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/tl/_clonotypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def define_clonotypes(
# For the case of "clonotypes" we want to compute the distance automatically
# if it doesn't exist yet. Since it's just a sparse ID matrix, this
# should be instant.
logging.info("ir_dist for sequence='nt' and metric='identity' not found. " "Computing with default parameters.") # type: ignore
logging.info("ir_dist for sequence='nt' and metric='identity' not found. Computing with default parameters.") # type: ignore
ir_dist(params, metric="identity", sequence="nt", key_added=distance_key)

return define_clonotype_clusters(
Expand Down
4 changes: 1 addition & 3 deletions src/scirpy/tl/_diversity.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def alpha_diversity(
if "percentage" in kwargs:
diversity[k] = _dxx(tmp_counts, percentage=cast(int, kwargs.get("percentage")))
else:
raise ValueError(
"DXX requires the `percentage` keyword argument, which can " "range from 0 to 100."
)
raise ValueError("DXX requires the `percentage` keyword argument, which can range from 0 to 100.")
else:
# make skbio an optional dependency
try:
Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/util/graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _get_igraph_from_adjacency(adj: csr_matrix, simplify=True):

if g.vcount() != adj.shape[0]:
logging.warning(
f"The constructed graph has only {g.vcount()} nodes. " "Your adjacency matrix contained redundant nodes."
f"The constructed graph has only {g.vcount()} nodes. Your adjacency matrix contained redundant nodes."
) # type: ignore

if simplify:
Expand Down
12 changes: 6 additions & 6 deletions src/scirpy/util/graph/_fr_size_aware_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def layout_fr_size_aware(
# ensure that it is an array
scale = np.array(scale)

assert len(origin) == len(
scale
), f"Arguments `origin` (d={len(origin)}) and `scale` (d={len(scale)}) need to have the same number of dimensions!"
assert len(origin) == len(scale), (
f"Arguments `origin` (d={len(origin)}) and `scale` (d={len(scale)}) need to have the same number of dimensions!"
)
dimensionality = len(origin)

unique_nodes = _get_unique_nodes(edge_list)
Expand All @@ -114,9 +114,9 @@ def layout_fr_size_aware(
else:
# 1) check input dimensionality
dimensionality_node_positions = np.array(list(node_positions.values())).shape[1]
assert (
dimensionality_node_positions == dimensionality
), f"The dimensionality of values of `node_positions` (d={dimensionality_node_positions}) must match the dimensionality of `origin`/ `scale` (d={dimensionality})!"
assert dimensionality_node_positions == dimensionality, (
f"The dimensionality of values of `node_positions` (d={dimensionality_node_positions}) must match the dimensionality of `origin`/ `scale` (d={dimensionality})!"
)

is_valid = _is_within_bbox(list(node_positions.values()), origin=origin, scale=scale)
if not np.all(is_valid):
Expand Down

0 comments on commit 581c9e7

Please sign in to comment.