Skip to content

Commit 64994d7

Browse files
authored
removes black in favor of ruff (#696)
* remove black * remove black * update test * change test value * change test value * update env
1 parent 5b1d7ba commit 64994d7

File tree

16 files changed

+23
-38
lines changed

16 files changed

+23
-38
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Thank you so much for your PR! To help us review your contribution, please consi
1515
## Checklist
1616
<!-- Feel free to remove check-list items that aren't relevant to your change -->
1717

18-
- [ ] Code style is correct (follows ruff and black guidelines)
18+
- [ ] Code style is correct (follows ruff guidelines)
1919
- [ ] Includes new or updated tests to cover the new feature
2020
- [ ] New features are properly documented (with an example if appropriate)
2121
- [ ] Includes a sample plot to visually illustrate the changes (only for plot-related functions)

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ jobs:
4343
- name: Run linters
4444
shell: bash -l {0}
4545
run: |
46-
python -m black preliz --check
47-
echo "Success!"
4846
echo "Checking code style with ruff..."
4947
ruff check preliz/
5048
- name: Run tests

.pre-commit-config.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
fail_fast: true
22

33
repos:
4-
- repo: https://github.com/ambv/black
5-
rev: 22.3.0
6-
hooks:
7-
- id: black
84
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.6.8
5+
rev: v0.14.1
106
hooks:
117
- id: ruff
128
args: [ --fix, --exit-non-zero-on-fix ]
139
- id: ruff-format
1410
types_or: [ python, pyi ]
1511
- repo: https://github.com/MarcoGorelli/madforhooks
16-
rev: 0.3.0
12+
rev: 0.4.1
1713
hooks:
1814
- id: no-print-statements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Exploring and eliciting probability distributions
66
[![PyPi version](https://badge.fury.io/py/preliz.svg)](https://badge.fury.io/py/preliz)
77
[![Build Status](https://github.com/arviz-devs/preliz/actions/workflows/test.yml/badge.svg)](https://github.com/arviz-devs/preliz/actions/workflows/test.yml)
88
[![codecov](https://codecov.io/gh/arviz-devs/preliz/branch/master/graph/badge.svg?token=SLJIK2O4C5 )](https://codecov.io/gh/arviz-devs/preliz/)
9-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
9+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1010
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05499/status.svg)](https://doi.org/10.21105/joss.05499)
1111

1212
## Overview

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"sphinx_tabs.tabs",
5353
"sphinx_design",
5454
"jupyter_sphinx",
55-
"sphinxcontrib.bibtex"
55+
"sphinxcontrib.bibtex",
5656
]
5757

5858
# -- Extension configuration -------------------------------------------------
@@ -146,7 +146,7 @@
146146

147147
# -- For Bibtex files ---------------------------------------------
148148

149-
bibtex_bibfiles = ['../preliz/internal/reference.bib']
149+
bibtex_bibfiles = ["../preliz/internal/reference.bib"]
150150

151151
# -- Options for LaTeX output ------------------------------------------------
152152

docs/get_cover_gallery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
for name, params in init_vals.items():
2020
try:
2121
dist_kind = getattr(distributions, name)().kind
22-
except:
22+
except TypeError:
2323
dist_kind = "modifier"
2424
color = category_colors.get(dist_kind, "C3")
2525
_, ax = plt.subplots(figsize=(3.5, 2.3))

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Exploring and eliciting probability distributions
44
|PyPI version|
55
|Tests|
66
|Coverage|
7-
|Black|
7+
|Ruff|
88
|DOI|
99

1010
.. |PyPI version| image:: https://badge.fury.io/py/preliz.svg
@@ -16,8 +16,8 @@ Exploring and eliciting probability distributions
1616
.. |Coverage| image:: https://codecov.io/gh/arviz-devs/preliz/branch/main/graph/badge.svg?token=SLJIK2O4C5
1717
:target: https://codecov.io/gh/arviz-devs/preliz
1818

19-
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
20-
:target: https://github.com/ambv/black
19+
.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
20+
:target: https://github.com/astral-sh/ruff
2121

2222
.. |DOI| image:: https://joss.theoj.org/papers/10.21105/joss.05499/status.svg
2323
:target: https://doi.org/10.21105/joss.05499

environment-dev.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ channels:
55
dependencies:
66
- python >= 3.11
77
- pip
8-
- matplotlib>=3.8
9-
- numba>=0.60
8+
- matplotlib>=3.9
9+
- numba>=0.62
1010
- numpy>=2.0
1111
- scipy>=1.12
1212
- nbclient>=0.2
1313
- ipywidgets
1414
- ipympl
1515
- jupyterlab
1616
- notebook
17-
- black==22.3.0
1817
- click
1918
- pytest-cov>=2.6.1
2019
- pytest>=4.4.0

preliz/distributions/asymmetric_laplace.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ def entropy(self):
129129

130130
def median(self):
131131
if self.kappa > 1:
132-
return self.mu + self.kappa * self.b * np.log(
133-
(1 + self.kappa**2) / (2 * self.kappa**2)
134-
)
132+
return self.mu + self.kappa * self.b * np.log((1 + self.kappa**2) / (2 * self.kappa**2))
135133
return self.mu - np.log((1 + self.kappa**2) / 2) / (self.kappa / self.b)
136134

137135
def mean(self):

preliz/distributions/distributions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ def moments(self, types="mvsk"):
267267
for m_t in types:
268268
if m_t not in "mdvsk":
269269
raise ValueError(
270-
"The input string should only contain the letters "
271-
"'m', 'd', 'v', 's', or 'k'."
270+
"The input string should only contain the letters 'm', 'd', 'v', 's', or 'k'."
272271
)
273272
if m_t == "m":
274273
moments.append(self.mean())

0 commit comments

Comments
 (0)