Skip to content

Commit

Permalink
linting with ruff 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmcdermott committed Mar 6, 2024
1 parent 321d4ea commit 39205b1
Show file tree
Hide file tree
Showing 67 changed files with 80 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
- name: ruff
run: |
ruff --version
ruff .
ruff format --check .
ruff check
- name: mypy
run: |
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The reaction-network package."""

from __future__ import annotations

from importlib.metadata import version
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Composition class used to represent a chemical composition."""

from __future__ import annotations

from functools import cached_property
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/costs/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic interface and implementation for a Calculator and CostFunction."""

from __future__ import annotations

from abc import ABCMeta, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/costs/calculators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A calculator class for determining chemical potential distance of reactions."""

from __future__ import annotations

from itertools import chain, combinations, product
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/costs/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of cost functions used in the package (e.g., Softplus, WeightedSum)."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/costs/pareto.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for performing Pareto front analysis."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/corrections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Energy correction classes for entry objects."""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/entry_set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""An entry set class for automatically building GibbsComputedEntry objects. Some of this
code has been adapted from the EntrySet class in pymatgen.
"""

from __future__ import annotations

import collections
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/experimental.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements an Entry that looks up NIST pre-tabulated Gibbs free energies."""

from __future__ import annotations

import hashlib
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/freed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements an Entry that looks up pre-tabulated Gibbs free energies from the NIST-JANAF
tables.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/gibbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
this is similar to the implementation within pymatgen, but has been refactored here to
add extra functionality.
"""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/interpolated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class for intepolated entries."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/nist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements an Entry that looks up pre-tabulated Gibbs free energies from the NIST-JANAF
tables.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/entries/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for acquiring, processing, or modifiying entries."""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/enumerators/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic interface for a reaction Enumerator."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/enumerators/basic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module implements two types of basic (combinatorial) reaction enumerators."""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/enumerators/minimize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module implements two types of reaction enumerators using a free energy
minimization technique, with or without the option of an open entry.
"""

from __future__ import annotations

from itertools import product
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/enumerators/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions used by the reaction enumerator classes."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/flows/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core flows for the reaction-network package."""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/jobs/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core definition for various task and synthesis recipe documents."""

from typing import Any, Optional

from pydantic import BaseModel, Field
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/jobs/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Definitions of common job functions."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/network/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic interface for a reaction network and its graph."""

from __future__ import annotations

from abc import ABCMeta, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/network/entry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Entry objects used in a Network. These network entry objects hold multiple entries and
can be used as data for a node in the graph.
"""

from __future__ import annotations

from enum import Enum, auto
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/network/network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of reaction network and graph classes."""

from __future__ import annotations

from queue import Empty, PriorityQueue
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/network/visualize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for visualizing/plotting reaction networks."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/balanced.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements a class for storing a balanced reaction pathway."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic interface for a reaction pathway."""

from __future__ import annotations

from abc import ABCMeta
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements a class for storing (unbalanced/unconstrained) collection of reactions
forming a reaction pathway.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/pathway_set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements a class for conveniently and efficiently storing sets of Pathway-based
objects which share entries/reactions.
"""

from __future__ import annotations

from functools import cached_property
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/plotting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains functions for plotting experimental reaction pathway data."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/pathways/solver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements a reaction pathway solver class which efficiently solves mass balance
equations using matrix operations.
"""

from __future__ import annotations

from abc import ABCMeta
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic interface for a (chemical) Reaction."""

from __future__ import annotations

from abc import ABCMeta, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module for defining chemical reaction objects was originally sourced from
pymatgen and streamlined for the reaction-network code.
"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/computed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""A reaction class that builds reactions based on ComputedEntry objects and provides
information about reaction thermodynamics.
"""

from __future__ import annotations

from functools import cached_property
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/hull.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code for analyzing sets of reactions between two phases."""

from __future__ import annotations

from functools import cached_property, lru_cache
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
of an open entry (e.g. O2), and provides information about reaction thermodynamics
computed as changes in grand potential.
"""

from __future__ import annotations

from functools import cached_property
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/plotting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for plotting reaction data & performing analysis."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/reactions/reaction_set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implements a class for conveniently and efficiently storing sets of ComputedReaction
objects which share entries.
"""

from __future__ import annotations

from collections import OrderedDict
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/thermo/chempot_diagram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module implements added features to the ChemicalPotentialDiagram class from
pymatgen.
"""

from __future__ import annotations

from functools import cached_property
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/thermo/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions used in the thermodynamic analysis classes."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/utils/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for interfacing with a reaction database."""

from __future__ import annotations

from jobflow import SETTINGS
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/utils/funcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions used throughout the reaction-network package."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions src/rxn_network/utils/ray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for working with Ray (parallelization library)."""

from __future__ import annotations

import os
Expand Down
3 changes: 2 additions & 1 deletion tests/costs/test_calculators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for ChempotDistanceCalculator """
"""Tests for ChempotDistanceCalculator"""

from pathlib import Path

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/costs/test_softplus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Softplus"""

import pytest
from rxn_network.costs.functions import Softplus

Expand Down
3 changes: 2 additions & 1 deletion tests/entries/test_corrections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for entry corrections. """
"""Tests for entry corrections."""

import pytest
from rxn_network.entries.corrections import CARBONATE_CORRECTION, CarbonateCorrection

Expand Down
3 changes: 2 additions & 1 deletion tests/entries/test_entry_set.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for GibbsEntrySet. """
"""Tests for GibbsEntrySet."""

from copy import deepcopy

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/entries/test_gibbs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for GibbsComputedEntry. Some tests adapted from pymatgen."""
"""Tests for GibbsComputedEntry. Some tests adapted from pymatgen."""

from pathlib import Path

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/entries/test_nist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for NISTReferenceEntry. """
"""Tests for NISTReferenceEntry."""

import pytest
from pymatgen.core.periodic_table import Element
from pymatgen.entries.computed_entries import ManualEnergyAdjustment
Expand Down
3 changes: 2 additions & 1 deletion tests/enumerators/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for BasicEnumerator and BasicOpenEnumerator """
"""Tests for BasicEnumerator and BasicOpenEnumerator"""

from pathlib import Path

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/enumerators/test_minimize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for MinimizeGibbsEnumerator and MinimizeGrandPotentialEnumerator """
"""Tests for MinimizeGibbsEnumerator and MinimizeGrandPotentialEnumerator"""

import pytest
from pymatgen.core.composition import Element
from rxn_network.enumerators.minimize import MinimizeGibbsEnumerator, MinimizeGrandPotentialEnumerator
Expand Down
2 changes: 1 addition & 1 deletion tests/network/test_entry.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Tests for NetworkEntry """
"""Tests for NetworkEntry"""
2 changes: 1 addition & 1 deletion tests/network/test_network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Tests for ReactionNetwork """
"""Tests for ReactionNetwork"""


def test_from_dict(ymno_rn):
Expand Down
2 changes: 1 addition & 1 deletion tests/pathways/test_basic.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Tests for BasicPathway """
"""Tests for BasicPathway"""
1 change: 1 addition & 0 deletions tests/pathways/test_plotting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for pathway plotter"""

import pytest
from rxn_network.pathways.plotting import PathwayPlotter

Expand Down
3 changes: 2 additions & 1 deletion tests/pathways/test_solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for PathwaySolver"""
"""Tests for PathwaySolver"""

from pathlib import Path

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/reactions/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Test for BasicReaction. Several tests adapted from
test module for pymatgen.analysis.reaction_calculator
"""

import pytest
from pymatgen.core.composition import Element
from rxn_network.core import Composition
Expand Down
3 changes: 2 additions & 1 deletion tests/reactions/test_computed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for ComputedReaction. Some tests adapted from pymatgen. """
"""Tests for ComputedReaction. Some tests adapted from pymatgen."""

from pathlib import Path

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/reactions/test_hull.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Tests for InterfaceReactionHull. """
"""Tests for InterfaceReactionHull."""

import pytest
from rxn_network.reactions.hull import InterfaceReactionHull

Expand Down
Loading

0 comments on commit 39205b1

Please sign in to comment.