Skip to content

Commit

Permalink
Simplify a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
tovrstra committed Jul 6, 2024
1 parent 390dc0c commit 2d70fd1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions iodata/docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def _document_load(
) -> Callable:
if kwdocs is None:
kwdocs = {}
notes = "" if notes is None else f"\nNotes\n-----\n\n{notes.strip()}\n"
ifpresent = ifpresent or []

def decorator(func):
Expand Down Expand Up @@ -117,8 +118,6 @@ def document_load_one(
"""
if kwdocs is None:
kwdocs = {}
if notes is not None:
notes = f"\nNotes\n-----\n\n{notes.strip()}\n"
return _document_load(LOAD_ONE_DOC_TEMPLATE, fmt, guaranteed, ifpresent, kwdocs, notes)


Expand Down Expand Up @@ -171,8 +170,6 @@ def document_load_many(
"""
if kwdocs is None:
kwdocs = {}
if notes is not None:
notes = f"\nNotes\n-----\n\n{notes.strip()}\n"
return _document_load(LOAD_MANY_DOC_TEMPLATE, fmt, guaranteed, ifpresent, kwdocs, notes)


Expand Down
7 changes: 2 additions & 5 deletions iodata/formats/fcidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
@document_load_one(
"Molpro 2012 FCIDUMP",
["core_energy", "one_ints", "nelec", "spinpol", "two_ints"],
[],
{},
LOAD_ONE_NOTES,
notes=LOAD_ONE_NOTES,
)
def load_one(lit: LineIterator) -> dict:
"""Do not edit this docstring. It will be overwritten."""
Expand Down Expand Up @@ -129,8 +127,7 @@ def load_one(lit: LineIterator) -> dict:
"Molpro 2012 FCIDUMP",
["one_ints", "two_ints"],
["core_energy", "nelec", "spinpol"],
{},
DUMP_ONE_NOTES,
notes=DUMP_ONE_NOTES,
)
def dump_one(f: TextIO, data: IOData):
"""Do not edit this docstring. It will be overwritten."""
Expand Down
2 changes: 1 addition & 1 deletion iodata/formats/gaussianlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"""


@document_load_one("Gaussian Log", [], ["one_ints", "two_ints"], {}, LOAD_ONE_NOTES)
@document_load_one("Gaussian Log", [], ["one_ints", "two_ints"], notes=LOAD_ONE_NOTES)
def load_one(lit: LineIterator) -> dict:
"""Do not edit this docstring. It will be overwritten."""
# First get the line with the number of orbital basis functions
Expand Down

0 comments on commit 2d70fd1

Please sign in to comment.