Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Saransh Chopra <[email protected]>
  • Loading branch information
arjxn-py and Saransh-cpp authored Nov 10, 2023
1 parent 700ab5a commit bfbe41e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pybamm/citations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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()
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions pybamm/expression_tree/printing/sympy_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand All @@ -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)
2 changes: 1 addition & 1 deletion pybamm/expression_tree/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bfbe41e

Please sign in to comment.