From 57e91975bf3b2dbcf7598aeecb02f3523a737eb6 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Sat, 20 Jun 2026 05:57:34 +0800 Subject: [PATCH] chore: update pre-commit hook with latest version --- .pre-commit-config.yaml | 16 ++++++------- CHANGELOG.rst | 4 ++-- news/pre-commit-update.rst | 23 +++++++++++++++++++ src/pyobjcryst/crystal.py | 5 ++-- .../diffractiondatasinglecrystal.py | 6 ++--- src/pyobjcryst/globaloptim.py | 1 + src/pyobjcryst/molecule.py | 5 ++-- src/pyobjcryst/powderpattern.py | 14 ++++++----- src/pyobjcryst/utils.py | 2 -- tests/pyobjcryst_test_mem.py | 5 ++-- tests/test_crystal.py | 1 - tests/test_molecule.py | 4 ---- tests/test_spacegroup.py | 1 - 13 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 news/pre-commit-update.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11c689b..b60917a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ ci: submodules: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: check-yaml - id: end-of-file-fixer @@ -21,15 +21,15 @@ repos: - id: check-toml - id: check-added-large-files - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 26.3.1 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 9.0.0a3 hooks: - id: isort args: ["--profile", "black"] @@ -39,14 +39,14 @@ repos: # hooks: # - id: nbstripout - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: no-commit-to-branch name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.2 hooks: - id: codespell exclude: '.*\.ipynb$' @@ -83,8 +83,8 @@ repos: additional_dependencies: - "prettier@^3.2.4" # docformatter - PEP 257 compliant docstring formatter - - repo: https://github.com/s-weigand/docformatter - rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.8 hooks: - id: docformatter additional_dependencies: [tomli] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e8be2d..baf2b14 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,7 +29,7 @@ Version 2024.2.1 **Changes:** * PowderPattern: - * Fix re-using a matplotlib figure when plotting + * Fix reusing a matplotlib figure when plotting * Add ``figure`` property Version 2024.2 @@ -125,7 +125,7 @@ Version 2.2.1 -- 2021-11-28 * Fix blank line javascript output when updating the Crystal 3D view * Add ``RefinableObj.xml()`` to directly get the XMLOutput as a string * Add example notebooks to the sphinx-generated html documentation -* Fix issue when using ``Crystal.XMLInput()`` for a non-empty structure. Existing scattering power will be re-used when possible, and otherwise not deleted anymore (which could lead to crashes) +* Fix issue when using ``Crystal.XMLInput()`` for a non-empty structure. Existing scattering power will be reused when possible, and otherwise not deleted anymore (which could lead to crashes) Version 2.2.0 -- 2021-06-08 ---------------------------- diff --git a/news/pre-commit-update.rst b/news/pre-commit-update.rst new file mode 100644 index 0000000..dd76c86 --- /dev/null +++ b/news/pre-commit-update.rst @@ -0,0 +1,23 @@ +**Added:** + +* No News Added: Updated pre-commit hook to latest version + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/pyobjcryst/crystal.py b/src/pyobjcryst/crystal.py index cc77ea2..5ea0d4a 100644 --- a/src/pyobjcryst/crystal.py +++ b/src/pyobjcryst/crystal.py @@ -40,7 +40,9 @@ import numpy as np -from pyobjcryst._pyobjcryst import BumpMergePar +from pyobjcryst._pyobjcryst import ( + BumpMergePar, +) from pyobjcryst._pyobjcryst import ( CreateCrystalFromCIF as CreateCrystalFromCIF_orig, ) @@ -277,7 +279,6 @@ def _display_list( independent atoms, no symmetry or translation is applied :return : the list of atoms and bonds to be displayed for 3dmol """ - spg = self.GetSpaceGroup() vv = [] idx = 0 diff --git a/src/pyobjcryst/diffractiondatasinglecrystal.py b/src/pyobjcryst/diffractiondatasinglecrystal.py index 59e23c1..cd287d8 100644 --- a/src/pyobjcryst/diffractiondatasinglecrystal.py +++ b/src/pyobjcryst/diffractiondatasinglecrystal.py @@ -36,9 +36,9 @@ def create_singlecrystaldata_from_cif(file, crystal): - """ - Create a DiffractionDataSingleCrystal object from a CIF file. Note that - this will use the last created Crystal as a reference structure. + """Create a DiffractionDataSingleCrystal object from a CIF file. + + Note that this will use the last created Crystal as a reference structure. Example using the COD to load both crystal and data: c=create_crystal_from_cif('http://www.crystallography.net/cod/2201530.cif') d=create_singlecrystaldata_from_cif('http://www.crystallography.net/cod/2201530.hkl', c) diff --git a/src/pyobjcryst/globaloptim.py b/src/pyobjcryst/globaloptim.py index 2567535..f0ab83f 100644 --- a/src/pyobjcryst/globaloptim.py +++ b/src/pyobjcryst/globaloptim.py @@ -16,6 +16,7 @@ Changes from ObjCryst::MonteCarloObj:: In development ! """ + __all__ = ["MonteCarlo", "AnnealingSchedule", "GlobalOptimType"] import warnings diff --git a/src/pyobjcryst/molecule.py b/src/pyobjcryst/molecule.py index 7d1ba73..9f04c13 100644 --- a/src/pyobjcryst/molecule.py +++ b/src/pyobjcryst/molecule.py @@ -126,8 +126,9 @@ def ImportFenskeHallZMatrix(cryst, src, named=False): - """Create a Molecule from a Fenske-Hall z-matrix. This is cleaner - than importing the Z-matrix into a ZScatterer object and then using + """Create a Molecule from a Fenske-Hall z-matrix. + + This is cleaner than importing the Z-matrix into a ZScatterer object and then using ZScatterer2Molecule, as it takes care of keeping only the created Molecule inside the Crystal. diff --git a/src/pyobjcryst/powderpattern.py b/src/pyobjcryst/powderpattern.py index bcb3f0a..f930482 100644 --- a/src/pyobjcryst/powderpattern.py +++ b/src/pyobjcryst/powderpattern.py @@ -32,7 +32,9 @@ "SpaceGroupExplorer", ] -from pyobjcryst._pyobjcryst import LSQ +from pyobjcryst._pyobjcryst import ( + LSQ, +) from pyobjcryst._pyobjcryst import ( CreatePowderPatternFromCIF as CreatePowderPatternFromCIF_orig, ) @@ -338,11 +340,11 @@ def _do_plot_hkl(self, nb_max=100, fontsize_hkl=None): @property def figure(self): - """ - return: the figure used for plotting, or None. Note that - if you want to display it in a notebook using ipympl (aka - 'matplotlib widget'), you should 'figure.canvas' to display - also the toolbar (zoom, etc...). + """Return: the figure used for plotting, or None. + + Note that if you want to display it in a notebook using ipympl + (aka 'matplotlib widget'), you should 'figure.canvas' to display + also the toolbar (zoom, etc...). """ return self._plot_fig diff --git a/src/pyobjcryst/utils.py b/src/pyobjcryst/utils.py index d696bed..49bcb1a 100644 --- a/src/pyobjcryst/utils.py +++ b/src/pyobjcryst/utils.py @@ -14,7 +14,6 @@ ############################################################################## """Utilities for crystals.""" - # FIXME: check if this function does any meaningful job. @@ -95,7 +94,6 @@ def f(v): def _xyztostring(crystal): """Helper function to write xyz coordinates of a crystal to a string.""" - nsc = 0 out = "" scl = crystal.GetScatteringComponentList() diff --git a/tests/pyobjcryst_test_mem.py b/tests/pyobjcryst_test_mem.py index 197758d..f096b2c 100644 --- a/tests/pyobjcryst_test_mem.py +++ b/tests/pyobjcryst_test_mem.py @@ -12,8 +12,9 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## -"""Small tests for pyobjcryst. Not run by pytest, for memory leak -checks. +"""Small tests for pyobjcryst. + +Not run by pytest, for memory leak checks. To check for memory leaks, run valgrind --tool=memcheck --leak- check=full python ./pyobjcrysttest.py diff --git a/tests/test_crystal.py b/tests/test_crystal.py index 6a25942..872d553 100644 --- a/tests/test_crystal.py +++ b/tests/test_crystal.py @@ -141,7 +141,6 @@ def testDummyAtom(self): def testEmbedding(self): """Test integrity of mutually-embedded objects.""" - c = makeCrystal(*makeScatterer()) class Level1(object): diff --git a/tests/test_molecule.py b/tests/test_molecule.py index 651ddce..9025f99 100644 --- a/tests/test_molecule.py +++ b/tests/test_molecule.py @@ -165,7 +165,6 @@ def testFindAtom(self): def testBonds(self): """Test the Bond methods.""" - a1 = self.m.GetAtom(0) a2 = self.m.GetAtom(1) a3 = self.m.GetAtom(2) @@ -746,7 +745,6 @@ def tearDown(self): def testStretchModeBondLength(self): """Test the StretchModeBondLength class.""" - # Measure the distance ac = self.m[0] # The 0, 0, z atom @@ -795,7 +793,6 @@ def tearDown(self): def testStretchModeBondAngle(self): """Test the StretchModeBondLength class.""" - a1 = self.m[1] ac = self.m[0] a2 = self.m[2] @@ -839,7 +836,6 @@ def tearDown(self): def testStretchModeTorsion(self): """Test the StretchModeBondLength class.""" - a1 = self.m[1] ac0 = self.m[3] ac1 = self.m[0] diff --git a/tests/test_spacegroup.py b/tests/test_spacegroup.py index 278523f..509c401 100644 --- a/tests/test_spacegroup.py +++ b/tests/test_spacegroup.py @@ -14,7 +14,6 @@ ############################################################################## """Unit tests for pyobjcryst.spacegroup.""" - import unittest from pyobjcryst.spacegroup import SpaceGroup