Skip to content

Commit

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

updates:
- [github.com/psf/black.git: 23.12.1 β†’ 24.1.1](https://github.com/psf/black.git/compare/23.12.1...24.1.1)

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

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

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 β†’ v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0)
- [github.com/psf/black.git: 23.9.1 β†’ 23.11.0](https://github.com/psf/black.git/compare/23.9.1...23.11.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.1 β†’ v1.7.0](pre-commit/mirrors-mypy@v1.5.1...v1.7.0)
- [github.com/PyCQA/pylint: v3.0.0a7 β†’ v3.0.1](pylint-dev/pylint@v3.0.0a7...v3.0.1)
- [github.com/pre-commit/mirrors-prettier: v3.0.3 β†’ v3.1.0](pre-commit/mirrors-prettier@v3.0.3...v3.1.0)
- [github.com/asottile/pyupgrade: v3.13.0 β†’ v3.15.0](asottile/pyupgrade@v3.13.0...v3.15.0)

* build: ⬆️ Update `black` and `pytest`

* docs: ♻️ Refactor model parameter assignment in `models.py`

* ci: 🚧 Add pre-commit setup and caching

* fix: πŸ“ Fix model parameter assignment

* build: ⬆️ Update dtale version to 3.9.0

* fix: πŸ’š Update pre-commit-config.yaml and models.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anselm Hahn <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and Anselmoo authored Jan 31, 2024
1 parent dde3fa9 commit 27e0b5d
Show file tree
Hide file tree
Showing 36 changed files with 531 additions and 435 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@ jobs:
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
pip freeze --local
- name: Cash pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Pre-commit
uses: pre-commit/[email protected]
run: |
pre-commit run --all-files --color=always
build:
name: Python ${{ matrix.python-version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
needs: pre-commit
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ repos:
args: ["--maxkb=1000"]
exclude: \.ipynb
- repo: https://github.com/psf/black.git
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black>=23.12.1]
additional_dependencies: [black>=24.1.1]
- repo: https://github.com/PyCQA/isort.git
rev: 5.13.2
hooks:
Expand Down
6 changes: 3 additions & 3 deletions docs/doc/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
model = model.lower()
if model.split("_")[0] not in __implemented_models__:
raise KeyError(f"{model} is not supported")
peak_kwargs[(model.split("_")[-1], model.split("_")[0])][
model.split("_")[1]
] = params[model]
peak_kwargs[(model.split("_")[-1], model.split("_")[0])][model.split("_")[1]] = (
params[model]
)

for key, _kwarg in peak_kwargs.items():
if key[1] == "my_new_model":
Expand Down
892 changes: 483 additions & 409 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jupyterlab = { version = ">=3.5.2,<5.0.0", optional = true }
plotly = { version = "^5.14.0", optional = true }
itables = { version = "^1.3.4", optional = true }
kaleido = { version = "0.2.1", optional = true }
dtale = { version = "^2.8.1", optional = true }
dtale = { version = "^3.9.0", optional = true }
networkx = { extras = [
"all",
], version = "^3.0", optional = true }
Expand All @@ -82,7 +82,7 @@ python-pptx = { version = "^0.6.22", optional = true }
[tool.poetry.group.dev.dependencies]
pylint = "^2.16.1"
mypy = "^1.1.1"
black = { extras = ["jupyter"], version = ">=22.8,<24.0" }
black = { extras = ["jupyter"], version = "^24.0" }
blacken-docs = "^1.12.1"
isort = "^5.10.1"
pre-commit = "^3.2.0"
Expand Down
1 change: 0 additions & 1 deletion spectrafit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
SpectraFit uses [Semantic Versioning](https://semver.org/).
"""


__version__ = "1.0.0"
1 change: 0 additions & 1 deletion spectrafit/api/cmd_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Reference model for the API of the command line interface."""


from datetime import datetime
from getpass import getuser
from hashlib import sha256
Expand Down
1 change: 0 additions & 1 deletion spectrafit/api/models_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Reference model for the API of the models distributions."""


from typing import Callable
from typing import List
from typing import Optional
Expand Down
1 change: 0 additions & 1 deletion spectrafit/api/notebook_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Reference model for the API of the Jupyter Notebook interface."""


from typing import List
from typing import Optional
from typing import Tuple
Expand Down
1 change: 1 addition & 0 deletions spectrafit/api/pptx_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PPTXModel class for SpectraFit API."""

import re
import tempfile

Expand Down
1 change: 1 addition & 0 deletions spectrafit/api/report_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reference model for the API of the Jupyter Notebook report."""

from typing import Any
from typing import Dict
from typing import Hashable
Expand Down
1 change: 0 additions & 1 deletion spectrafit/api/rixs_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Reference model for the API of the Jupyter Notebook interface."""


from typing import Any
from typing import Optional
from typing import Tuple
Expand Down
1 change: 0 additions & 1 deletion spectrafit/api/test/test_cmd_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test of CMD and Tool Model."""


from getpass import getuser
from hashlib import sha256
from socket import gethostname
Expand Down
1 change: 1 addition & 0 deletions spectrafit/api/test/test_file_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the file model."""

import pytest

from spectrafit.api.file_model import DataFileAPI
Expand Down
1 change: 1 addition & 0 deletions spectrafit/api/test/test_pptx_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the pptx_model module."""

from math import isclose
from typing import Tuple
from typing import Type
Expand Down
1 change: 0 additions & 1 deletion spectrafit/api/tools_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Reference model for the API of the SpectraFit tools."""


from typing import Any
from typing import Dict
from typing import List
Expand Down
1 change: 0 additions & 1 deletion spectrafit/app/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Starting jupyter lab as a app."""


import sys

from jupyterlab.labapp import main
Expand Down
1 change: 1 addition & 0 deletions spectrafit/app/test/test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test of the Jupiter plugin app."""

from unittest import mock


Expand Down
6 changes: 2 additions & 4 deletions spectrafit/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Minimization models for curve fitting."""

from collections import defaultdict
from dataclasses import dataclass
from math import log
Expand Down Expand Up @@ -563,10 +564,7 @@ def polynom3(
NDArray[np.float64]: Third order polynomial function of `x`
"""
return np.array(
coefficient0
+ coefficient1 * x
+ coefficient2 * x**2
+ coefficient3 * x**3
coefficient0 + coefficient1 * x + coefficient2 * x**2 + coefficient3 * x**3
)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions spectrafit/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
this, you can comment out the line `matplotlib.font_manager._rebuild()` in
the `plotting.py` file.
"""

from typing import Any
from typing import Dict
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions spectrafit/plugins/color_schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Color themes for the Plots in Jupyter Notebooks."""

from typing import List

from spectrafit.api.notebook_model import ColorAPI
Expand Down
1 change: 1 addition & 0 deletions spectrafit/plugins/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Abstract base class for the converter plugins."""

from abc import ABC
from abc import abstractmethod
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions spectrafit/plugins/file_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert the input and output files to the preferred file format."""

import argparse
import json

Expand Down
1 change: 1 addition & 0 deletions spectrafit/plugins/pptx_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert the lock file to a powerpoint presentation."""

import argparse

from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion spectrafit/plugins/test/test_rixs_visualizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test of the RIXS Visualizer."""


from pathlib import Path
from typing import Any
from typing import Tuple
Expand Down
1 change: 1 addition & 0 deletions spectrafit/report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fit-Results as Report."""

import pprint
import sys

Expand Down
1 change: 1 addition & 0 deletions spectrafit/spectrafit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SpectraFit, the command line tool for fitting."""

import argparse

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions spectrafit/test/test_plot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest of the plotting features of spectrafit."""

import pandas as pd

from matplotlib import pyplot
Expand Down
1 change: 1 addition & 0 deletions spectrafit/test/test_report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest of report model."""

from math import isclose
from typing import Any
from typing import Dict
Expand Down
1 change: 1 addition & 0 deletions spectrafit/test/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest of tools model."""

import gzip
import pickle

Expand Down
8 changes: 5 additions & 3 deletions spectrafit/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ def rename_columns(self, df: pd.DataFrame) -> pd.DataFrame:
if self.args["global_"]:
return df.rename(
columns={
col: ColumnNamesAPI().energy
if i == 0
else f"{ColumnNamesAPI().intensity}_{i}"
col: (
ColumnNamesAPI().energy
if i == 0
else f"{ColumnNamesAPI().intensity}_{i}"
)
for i, col in enumerate(df.columns)
}
)
Expand Down
1 change: 1 addition & 0 deletions spectrafit/utilities/test/test_transformer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test of the jupyter plugin."""

from typing import Any
from typing import Dict
from typing import List
Expand Down
1 change: 1 addition & 0 deletions spectrafit/utilities/transformer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Transformer functions for the SpectraFit."""

from typing import Any
from typing import Dict
from typing import List
Expand Down
1 change: 1 addition & 0 deletions tools/spectra_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for generating spectra for testing."""

import math

from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion vendor/docker-stacks
Submodule docker-stacks updated 182 files

0 comments on commit 27e0b5d

Please sign in to comment.