Skip to content

Commit

Permalink
Update black version requirement and apply latest version to source (
Browse files Browse the repository at this point in the history
…#514)

* Change black version specification

* Apply updated black version to source

* Update black version in workflow

* Resolve CI failure on macos

* Apply updated black version to source
  • Loading branch information
bwohlberg authored Apr 29, 2024
1 parent bea60a4 commit b71d191
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Black code formatter
uses: psf/black@stable
with:
version: "22.3"
version: ">=24.3.0"
- name: Isort import sorter
uses: isort/isort-action@v1
- name: Pylint code analysis
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:

test:
runs-on: macos-latest
runs-on: macos-13
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ pytest>=7.3.0
pytest-split
packaging
pre-commit
black>=22.3,<23
black>=24.3.0
isort
autoflake
1 change: 1 addition & 0 deletions docs/source/conf/25-napoleon.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def parse_class_attributes_section(self, section):

GoogleDocstring._parse_class_attributes_section = parse_class_attributes_section


# we now patch the parse method to guarantee that the the above methods are
# assigned to the _section dict
def patched_parse(self):
Expand Down
1 change: 0 additions & 1 deletion examples/scripts/sparsecode_poisson_apgm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@

# Define composed operator.
class ForwardOperator(Operator):

"""Toy problem non-linear forward operator with different treatment
of x[0] and x[1].
Expand Down
1 change: 1 addition & 0 deletions scico/flax/inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ class ODPGrDescBlock(Module):
alpha_ini: Initial value of the fidelity weight `alpha`.
dtype: Output dtype. Default: :attr:`~numpy.float32`.
"""

operator: ModuleDef
depth: int
channels: int
Expand Down
4 changes: 1 addition & 3 deletions scico/functional/_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,7 @@ def __init__(self, delta: float = 1.0, separable: bool = True):

def _call_sep(self, x: Union[Array, BlockArray]) -> float:
xabs = snp.abs(x)
hx = snp.where(
xabs <= self.delta, 0.5 * xabs**2, self.delta * (xabs - (self.delta / 2.0))
)
hx = snp.where(xabs <= self.delta, 0.5 * xabs**2, self.delta * (xabs - (self.delta / 2.0)))
return snp.sum(hx)

def _call_nonsep(self, x: Union[Array, BlockArray]) -> float:
Expand Down
1 change: 1 addition & 0 deletions scico/linop/xray/astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def fbp(self, sino: jax.Array, filter_type: str = "Ram-Lak") -> jax.Array:
see `cfg.FilterType` in the `ASTRA documentation
<https://www.astra-toolbox.com/docs/algs/FBP_CUDA.html>`__.
"""

# Just use the CPU FBP alg for now; hitting memory issues with GPU one.
def f(sino):
sino = _ensure_writeable(sino)
Expand Down
1 change: 1 addition & 0 deletions scico/numpy/_blockarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def prop_ba(self):
for prop_name in da_props:
setattr(BlockArray, prop_name, _da_prop_wrapper(prop_name))


# Wrap jax array methods.
def _da_method_wrapper(method_name):
method = getattr(Array, method_name)
Expand Down
4 changes: 3 additions & 1 deletion scico/optimize/_admmaux.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,9 @@ def compute_rhs(self) -> Union[Array, BlockArray]:
C0 = self.admm.C_list[0]
rhs = snp.zeros(C0.input_shape, C0.input_dtype)
omega = self.admm.g_list[0].scale
omega_list = [2.0 * omega,] + [
omega_list = [
2.0 * omega,
] + [
1.0,
] * (len(self.admm.C_list) - 1)
for omegai, rhoi, Ci, zi, ui in zip(
Expand Down
1 change: 1 addition & 0 deletions scico/test/flax/test_clu.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_count_parameters_empty():
+--------------------+--------------+------+------+-----+
Total weights: 56"""


# From https://github.com/google/CommonLoopUtils/blob/main/clu/parameter_overview_test.py
def test_get_parameter_overview_empty():
assert get_parameter_overview({}) == EMPTY_PARAMETER_OVERVIEW
Expand Down
1 change: 1 addition & 0 deletions scico/test/linop/test_conversions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test methods that make one kind of Operator out of another.
"""

import numpy as np

import pytest
Expand Down

0 comments on commit b71d191

Please sign in to comment.