Skip to content

Commit 294ad8f

Browse files
committed
black formatter
1 parent 7b77de5 commit 294ad8f

13 files changed

Lines changed: 274 additions & 19978 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ipynb -linguist-detectable

.gitignore

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
# Bytecode
2+
__pycache__/
3+
4+
# Distribution/packaging
5+
build/
16
dist/
2-
saibr.egg-info/
3-
docs/build/
7+
*.egg-info/
8+
9+
# Unit tests
10+
.coverage
11+
.pytest_cache/
12+
13+
# OS
414
.DS_Store
5-
__pycache__
15+
16+
# IPython notebooks
17+
.ipynb_checkpoints
18+

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.10.0
4+
hooks:
5+
- id: black

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# SAIBR (python implementation)
22

33
[![CC BY 4.0][cc-by-shield]][cc-by]
4+
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
5+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
6+
[![Tests](https://github.com/goehringlab/saibr_python/actions/workflows/test.yaml/badge.svg)](https://github.com/goehringlab/saibr_python/actions/workflows/test.yaml)
47
[![PyPi version](https://badgen.net/pypi/v/saibr/)](https://pypi.org/project/saibr)
58
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/goehringlab/saibr_python/HEAD?filepath=%2Fscripts/SAIBRdemonstration.ipynb)
69
[![Documentation Status](https://readthedocs.org/projects/saibr/badge/?version=latest)](https://saibr.readthedocs.io/en/latest/?badge=latest)

docs/source/conf.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
3-
sys.path.insert(0, os.path.abspath('../..'))
3+
4+
sys.path.insert(0, os.path.abspath("../.."))
45

56
# Configuration file for the Sphinx documentation builder.
67
#
@@ -10,27 +11,24 @@
1011
# -- Project information -----------------------------------------------------
1112
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1213

13-
project = 'saibr'
14-
copyright = '2023, Tom Bland'
15-
author = 'Tom Bland'
16-
release = '0.1.5'
14+
project = "saibr"
15+
copyright = "2023, Tom Bland"
16+
author = "Tom Bland"
17+
release = "0.1.5"
1718

1819
# -- General configuration ---------------------------------------------------
1920
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2021

21-
extensions = [
22-
'sphinx.ext.autodoc',
23-
'sphinx.ext.napoleon'
24-
]
25-
autoapi_dirs = ['../../saibr']
22+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"]
23+
autoapi_dirs = ["../../saibr"]
2624

2725

28-
templates_path = ['_templates']
26+
templates_path = ["_templates"]
2927
exclude_patterns = []
3028

3129

3230
# -- Options for HTML output -------------------------------------------------
3331
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3432

35-
html_theme = 'sphinx_rtd_theme'
36-
html_static_path = ['_static']
33+
html_theme = "sphinx_rtd_theme"
34+
html_static_path = ["_static"]

saibr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
__all__ = []
66
__all__.extend(saibr.__all__)
7-
__all__.extend(misc.__all__)
7+
__all__.extend(misc.__all__)

saibr/legacy.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
from saibr import SaibrCalibrate, saibr_correlation, saibr_correlation_3channel, saibr_correct, saibr_correct_3channel
1+
from saibr import (
2+
SaibrCalibrate,
3+
saibr_correlation,
4+
saibr_correlation_3channel,
5+
saibr_correct,
6+
saibr_correct_3channel,
7+
)
28

3-
__all__ = ['AfCorrelation', 'af_correlation', 'af_correlation_3channel', 'af_subtraction', 'af_subtraction_3channel']
9+
__all__ = [
10+
"AfCorrelation",
11+
"af_correlation",
12+
"af_correlation_3channel",
13+
"af_subtraction",
14+
"af_subtraction_3channel",
15+
]
416

517
AfCorrelation = SaibrCalibrate
618
af_correlation = saibr_correlation

saibr/misc.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import matplotlib.pyplot as plt
66
import copy
77

8-
__all__ = ['load_image', 'save_img', 'save_img_jpeg', 'direcslist']
8+
__all__ = ["load_image", "save_img", "save_img_jpeg", "direcslist"]
9+
910

1011
def load_image(filename: str) -> np.ndarray:
1112
"""
@@ -32,11 +33,16 @@ def save_img(img: np.ndarray, direc: str):
3233
3334
"""
3435

35-
io.imsave(direc, img.astype('float32'))
36+
io.imsave(direc, img.astype("float32"))
3637

3738

38-
def save_img_jpeg(img: np.ndarray, direc: str, cmin: Optional[float] = None, cmax: Optional[float] = None,
39-
cmap: str = 'gray'):
39+
def save_img_jpeg(
40+
img: np.ndarray,
41+
direc: str,
42+
cmin: Optional[float] = None,
43+
cmax: Optional[float] = None,
44+
cmap: str = "gray",
45+
):
4046
"""
4147
Saves 2D array as jpeg, according to min and max pixel intensities
4248
@@ -52,14 +58,18 @@ def save_img_jpeg(img: np.ndarray, direc: str, cmin: Optional[float] = None, cma
5258
plt.imsave(direc, img, vmin=cmin, vmax=cmax, cmap=cmap)
5359

5460

55-
def _direcslist(dest: str, levels: int = 0, exclude: Optional[tuple] = ('!',),
56-
exclusive: Optional[tuple] = None) -> list:
57-
lis = sorted(glob.glob(f'{dest}/*/'))
61+
def _direcslist(
62+
dest: str,
63+
levels: int = 0,
64+
exclude: Optional[tuple] = ("!",),
65+
exclusive: Optional[tuple] = None,
66+
) -> list:
67+
lis = sorted(glob.glob(f"{dest}/*/"))
5868

5969
for level in range(levels):
6070
newlis = []
6171
for e in lis:
62-
newlis.extend(sorted(glob.glob(f'{e}/*/')))
72+
newlis.extend(sorted(glob.glob(f"{e}/*/")))
6373
lis = newlis
6474
lis = [x[:-1] for x in lis]
6575

@@ -85,8 +95,12 @@ def _direcslist(dest: str, levels: int = 0, exclude: Optional[tuple] = ('!',),
8595
return sorted(lis2)
8696

8797

88-
def direcslist(dest: str, levels: int = 0, exclude: Optional[tuple] = ('!',),
89-
exclusive: Optional[tuple] = None) -> list:
98+
def direcslist(
99+
dest: str,
100+
levels: int = 0,
101+
exclude: Optional[tuple] = ("!",),
102+
exclusive: Optional[tuple] = None,
103+
) -> list:
90104
"""
91105
Gives a list of directories within a given directory (full path)
92106
Todo: os.walk

0 commit comments

Comments
 (0)