From a5a4ffd8b642dc0d76759ad46ebe9d7a9e049210 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Wed, 18 Oct 2023 16:54:28 -0600 Subject: [PATCH 1/2] updated black formatting --- Support/ceptr/ceptr/__init__.py | 1 + Support/ceptr/ceptr/__main__.py | 1 + Support/ceptr/ceptr/ceptr.py | 1 + Support/ceptr/ceptr/ck.py | 1 + Support/ceptr/ceptr/constants.py | 1 + Support/ceptr/ceptr/converter.py | 1 + Support/ceptr/ceptr/formatter.py | 1 - Support/ceptr/ceptr/gjs.py | 1 + Support/ceptr/ceptr/inputs.py | 1 + Support/ceptr/ceptr/jacobian.py | 1 + Support/ceptr/ceptr/production.py | 5 ++--- Support/ceptr/ceptr/qssa.py | 1 + Support/ceptr/ceptr/qssa_converter.py | 1 + Support/ceptr/ceptr/qssa_graphs.py | 1 + Support/ceptr/ceptr/qssa_info.py | 1 + Support/ceptr/ceptr/qssa_reduction.py | 1 + Support/ceptr/ceptr/reaction_info.py | 1 + Support/ceptr/ceptr/sparsity.py | 1 + Support/ceptr/ceptr/species_info.py | 1 + Support/ceptr/ceptr/symbolic_math.py | 1 + Support/ceptr/ceptr/thermo.py | 1 + Support/ceptr/ceptr/transport.py | 1 + Support/ceptr/ceptr/utilities.py | 1 + Support/ceptr/ceptr/writer.py | 1 - Support/ceptr/tests/test_ceptr.py | 1 + 25 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Support/ceptr/ceptr/__init__.py b/Support/ceptr/ceptr/__init__.py index 9b56d3059..c2367dfb9 100644 --- a/Support/ceptr/ceptr/__init__.py +++ b/Support/ceptr/ceptr/__init__.py @@ -1,2 +1,3 @@ """CEPTR.""" + __version__ = "0.1.0" diff --git a/Support/ceptr/ceptr/__main__.py b/Support/ceptr/ceptr/__main__.py index d42e3ac2b..68ffa399e 100644 --- a/Support/ceptr/ceptr/__main__.py +++ b/Support/ceptr/ceptr/__main__.py @@ -1,4 +1,5 @@ """Executable for CEPTR package.""" + import ceptr.ceptr as cp if __name__ == "__main__": diff --git a/Support/ceptr/ceptr/ceptr.py b/Support/ceptr/ceptr/ceptr.py index ddde831a2..07b366cfa 100644 --- a/Support/ceptr/ceptr/ceptr.py +++ b/Support/ceptr/ceptr/ceptr.py @@ -1,4 +1,5 @@ """Convert cantera mechanism to C++ files.""" + import argparse import pathlib import time diff --git a/Support/ceptr/ceptr/ck.py b/Support/ceptr/ceptr/ck.py index e71be20c7..0079b5f28 100644 --- a/Support/ceptr/ceptr/ck.py +++ b/Support/ceptr/ceptr/ck.py @@ -1,4 +1,5 @@ """CK routines.""" + import ceptr.constants as cc import ceptr.thermo as cth import ceptr.writer as cw diff --git a/Support/ceptr/ceptr/constants.py b/Support/ceptr/ceptr/constants.py index 5561c12a3..d1683e683 100644 --- a/Support/ceptr/ceptr/constants.py +++ b/Support/ceptr/ceptr/constants.py @@ -1,4 +1,5 @@ """Constants.""" + import cantera as ct from pint import UnitRegistry diff --git a/Support/ceptr/ceptr/converter.py b/Support/ceptr/ceptr/converter.py index 572c8780c..04a6fede7 100644 --- a/Support/ceptr/ceptr/converter.py +++ b/Support/ceptr/ceptr/converter.py @@ -1,4 +1,5 @@ """Generate C++ files for a mechanism.""" + import pathlib import shutil import subprocess as spr diff --git a/Support/ceptr/ceptr/formatter.py b/Support/ceptr/ceptr/formatter.py index 8fa13931f..c900ea727 100644 --- a/Support/ceptr/ceptr/formatter.py +++ b/Support/ceptr/ceptr/formatter.py @@ -1,6 +1,5 @@ """Helper functions for CPP formatting.""" - def format_species(species): """Remove characters not allowed in preprocessor defines.""" s = species.strip() diff --git a/Support/ceptr/ceptr/gjs.py b/Support/ceptr/ceptr/gjs.py index ef0aaa1bd..5b6eaeecb 100644 --- a/Support/ceptr/ceptr/gjs.py +++ b/Support/ceptr/ceptr/gjs.py @@ -1,4 +1,5 @@ """Gauss-Jordan functions.""" + import ceptr.writer as cw diff --git a/Support/ceptr/ceptr/inputs.py b/Support/ceptr/ceptr/inputs.py index 998cedf81..118d6308e 100644 --- a/Support/ceptr/ceptr/inputs.py +++ b/Support/ceptr/ceptr/inputs.py @@ -1,4 +1,5 @@ """Classes for toml input files.""" + import sys import toml diff --git a/Support/ceptr/ceptr/jacobian.py b/Support/ceptr/ceptr/jacobian.py index eabc2e6ea..a007435ba 100644 --- a/Support/ceptr/ceptr/jacobian.py +++ b/Support/ceptr/ceptr/jacobian.py @@ -1,4 +1,5 @@ """Write jacobian functions.""" + import copy import sys from collections import Counter, OrderedDict diff --git a/Support/ceptr/ceptr/production.py b/Support/ceptr/ceptr/production.py index 2b035abd9..07ebc06ce 100644 --- a/Support/ceptr/ceptr/production.py +++ b/Support/ceptr/ceptr/production.py @@ -1,4 +1,5 @@ """Production functions.""" + import sys from math import isclose @@ -696,9 +697,7 @@ def production_rate( f" {10 ** (-dim * 6) * low_pef.m * 10 ** 3 ** dim:.15g} ", ) redp_smp = ( - corr_smp - / k_f_smp - * (10 ** (-dim * 6) * low_pef.m * 10 ** (3**dim)) + corr_smp / k_f_smp * (10 ** (-dim * 6) * low_pef.m * 10 ** (3**dim)) ) if (low_beta == 0) and (low_ae.m == 0): cw.writer( diff --git a/Support/ceptr/ceptr/qssa.py b/Support/ceptr/ceptr/qssa.py index d018caa8f..e755f25ef 100644 --- a/Support/ceptr/ceptr/qssa.py +++ b/Support/ceptr/ceptr/qssa.py @@ -1,4 +1,5 @@ """Generate QSSA chemistry file.""" + import argparse import pathlib import sys diff --git a/Support/ceptr/ceptr/qssa_converter.py b/Support/ceptr/ceptr/qssa_converter.py index e1e7973cb..91ed79f9b 100644 --- a/Support/ceptr/ceptr/qssa_converter.py +++ b/Support/ceptr/ceptr/qssa_converter.py @@ -1,4 +1,5 @@ """QSSA functions needed for conversion.""" + import copy import sys from collections import Counter, OrderedDict, defaultdict diff --git a/Support/ceptr/ceptr/qssa_graphs.py b/Support/ceptr/ceptr/qssa_graphs.py index 627011975..57208f0f2 100644 --- a/Support/ceptr/ceptr/qssa_graphs.py +++ b/Support/ceptr/ceptr/qssa_graphs.py @@ -1,4 +1,5 @@ """Graph utilities for QSSA.""" + import pathlib import matplotlib.pyplot as plt diff --git a/Support/ceptr/ceptr/qssa_info.py b/Support/ceptr/ceptr/qssa_info.py index 43f70f295..a8620c511 100644 --- a/Support/ceptr/ceptr/qssa_info.py +++ b/Support/ceptr/ceptr/qssa_info.py @@ -1,4 +1,5 @@ """QSSA information.""" + from collections import OrderedDict diff --git a/Support/ceptr/ceptr/qssa_reduction.py b/Support/ceptr/ceptr/qssa_reduction.py index 81cac8938..098bba77e 100644 --- a/Support/ceptr/ceptr/qssa_reduction.py +++ b/Support/ceptr/ceptr/qssa_reduction.py @@ -1,4 +1,5 @@ """QSSA utilities.""" + import itertools import ceptr.qssa_graphs as cqg diff --git a/Support/ceptr/ceptr/reaction_info.py b/Support/ceptr/ceptr/reaction_info.py index 5efb7def2..a92575bda 100644 --- a/Support/ceptr/ceptr/reaction_info.py +++ b/Support/ceptr/ceptr/reaction_info.py @@ -1,4 +1,5 @@ """Reaction information.""" + from collections import OrderedDict import ceptr.constants as cc diff --git a/Support/ceptr/ceptr/sparsity.py b/Support/ceptr/ceptr/sparsity.py index 0b889e034..254d3ee85 100644 --- a/Support/ceptr/ceptr/sparsity.py +++ b/Support/ceptr/ceptr/sparsity.py @@ -1,4 +1,5 @@ """Sparsity patterns.""" + import ceptr.writer as cw diff --git a/Support/ceptr/ceptr/species_info.py b/Support/ceptr/ceptr/species_info.py index c25ba9c2f..e0af9cfb3 100644 --- a/Support/ceptr/ceptr/species_info.py +++ b/Support/ceptr/ceptr/species_info.py @@ -1,4 +1,5 @@ """Species information.""" + from collections import OrderedDict import pandas as pd diff --git a/Support/ceptr/ceptr/symbolic_math.py b/Support/ceptr/ceptr/symbolic_math.py index 140a91bb6..35dfe2760 100644 --- a/Support/ceptr/ceptr/symbolic_math.py +++ b/Support/ceptr/ceptr/symbolic_math.py @@ -1,4 +1,5 @@ """Symbolic math for symbolic differentiation.""" + import re from collections import OrderedDict diff --git a/Support/ceptr/ceptr/thermo.py b/Support/ceptr/ceptr/thermo.py index 4b7313349..9ed1c517e 100644 --- a/Support/ceptr/ceptr/thermo.py +++ b/Support/ceptr/ceptr/thermo.py @@ -1,4 +1,5 @@ """Thermodynamics functions.""" + import io import sys from collections import OrderedDict diff --git a/Support/ceptr/ceptr/transport.py b/Support/ceptr/ceptr/transport.py index 0dfe46a3c..2d2301005 100644 --- a/Support/ceptr/ceptr/transport.py +++ b/Support/ceptr/ceptr/transport.py @@ -1,4 +1,5 @@ """Transport routines.""" + import sys from collections import OrderedDict diff --git a/Support/ceptr/ceptr/utilities.py b/Support/ceptr/ceptr/utilities.py index 54d95b414..df5e129a7 100644 --- a/Support/ceptr/ceptr/utilities.py +++ b/Support/ceptr/ceptr/utilities.py @@ -1,4 +1,5 @@ """Utility functions used across ceptr.""" + import copy import sys from collections import Counter diff --git a/Support/ceptr/ceptr/writer.py b/Support/ceptr/ceptr/writer.py index 923995705..8401043fc 100644 --- a/Support/ceptr/ceptr/writer.py +++ b/Support/ceptr/ceptr/writer.py @@ -1,6 +1,5 @@ """Helper functions for printing.""" - def comment(string): """Comment a string.""" return f"""// {string}""" diff --git a/Support/ceptr/tests/test_ceptr.py b/Support/ceptr/tests/test_ceptr.py index 724196d81..2c93c196a 100644 --- a/Support/ceptr/tests/test_ceptr.py +++ b/Support/ceptr/tests/test_ceptr.py @@ -1,4 +1,5 @@ """Tests for cepter.""" + import pathlib import cantera as ct From c89d0730404e13dd500aaa399f2cfb4a47605f84 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Wed, 18 Oct 2023 16:54:51 -0600 Subject: [PATCH 2/2] ignore E302 in flake8 due to updated black formatting --- Support/ceptr/.flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Support/ceptr/.flake8 b/Support/ceptr/.flake8 index 1ba999d9f..25f91c596 100644 --- a/Support/ceptr/.flake8 +++ b/Support/ceptr/.flake8 @@ -2,7 +2,7 @@ max-line-length = 88 max-complexity = 10 select = C,E,F,W,B,B950,N,D -ignore = E203,E501,W503,C901,FS003 +ignore = E203,E302,E501,W503,C901,FS003 docstring-convention = numpy exclude = .git,