From bfbe41e36d32b9afc7d8643fd078f9fe70333bff Mon Sep 17 00:00:00 2001 From: Arjun Date: Fri, 10 Nov 2023 18:20:35 +0530 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Saransh Chopra --- pybamm/citations.py | 8 ++++---- pybamm/expression_tree/printing/sympy_overrides.py | 4 ++-- pybamm/expression_tree/symbol.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pybamm/citations.py b/pybamm/citations.py index 7d0959d89c..b72262989b 100644 --- a/pybamm/citations.py +++ b/pybamm/citations.py @@ -74,7 +74,7 @@ def read_citations(self): """Reads the citations in `pybamm.CITATIONS.bib`. Other works can be cited by passing a BibTeX citation to :meth:`register`. """ - parse_file = have_optional_dependency("pybtex.database","parse_file") + parse_file = have_optional_dependency("pybtex.database", "parse_file") citations_file = os.path.join(pybamm.root_dir(), "pybamm", "CITATIONS.bib") bib_data = parse_file(citations_file, bib_format="bibtex") for key, entry in bib_data.entries.items(): @@ -85,7 +85,7 @@ def _add_citation(self, key, entry): previous entry is overwritten """ - Entry = have_optional_dependency("pybtex.database","Entry") + Entry = have_optional_dependency("pybtex.database", "Entry") # Check input types are correct if not isinstance(key, str) or not isinstance(entry, Entry): raise TypeError() @@ -151,8 +151,8 @@ def _parse_citation(self, key): key: str A BibTeX formatted citation """ - PybtexError = have_optional_dependency("pybtex.scanner","PybtexError") - parse_string = have_optional_dependency("pybtex.database","parse_string") + PybtexError = have_optional_dependency("pybtex.scanner", "PybtexError") + parse_string = have_optional_dependency("pybtex.database", "parse_string") try: # Parse string as a bibtex citation, and check that a citation was found bib_data = parse_string(key, bib_format="bibtex") diff --git a/pybamm/expression_tree/printing/sympy_overrides.py b/pybamm/expression_tree/printing/sympy_overrides.py index 59f9567c5d..64743f557d 100644 --- a/pybamm/expression_tree/printing/sympy_overrides.py +++ b/pybamm/expression_tree/printing/sympy_overrides.py @@ -6,7 +6,7 @@ from pybamm.util import have_optional_dependency -LatexPrinter = have_optional_dependency("sympy.printing.latex","LatexPrinter") +LatexPrinter = have_optional_dependency("sympy.printing.latex", "LatexPrinter") class CustomPrint(LatexPrinter): """Override SymPy methods to match PyBaMM's requirements""" @@ -22,5 +22,5 @@ def _print_Derivative(self, expr): def custom_print_func(expr, **settings): - have_optional_dependency("sympy.printing.latex","LatexPrinter") + have_optional_dependency("sympy.printing.latex", "LatexPrinter") return CustomPrint().doprint(expr) diff --git a/pybamm/expression_tree/symbol.py b/pybamm/expression_tree/symbol.py index 85c392e590..8f1608e7ba 100644 --- a/pybamm/expression_tree/symbol.py +++ b/pybamm/expression_tree/symbol.py @@ -459,7 +459,7 @@ def visualise(self, filename): filename to output, must end in ".png" """ - DotExporter = have_optional_dependency("anytree.exporter","DotExporter") + DotExporter = have_optional_dependency("anytree.exporter", "DotExporter") # check that filename ends in .png. if filename[-4:] != ".png": raise ValueError("filename should end in .png")