Skip to content

Commit 67d5b12

Browse files
author
Alan Christie
committed
style: Fix atom-block missing END and module rename
1 parent 4c8aab3 commit 67d5b12

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

dm_job_utilities/misc.py renamed to dm_job_utilities/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
# Extracted 19th March 2024
55
#
6+
# Use this new module with "from dm_job_utilities import utils"
7+
#
68
# Includes style changes to align with the pre-existing modules
79
# and the following modifications/changes: -
810
#
@@ -36,6 +38,10 @@ def expand_path(path) -> None:
3638
def update_charge_flag_in_atom_block(atom_block) -> str:
3739
"""See https://sourceforge.net/p/rdkit/mailman/message/36425493/
3840
"""
41+
# To simply fix the missing END, found during unit testing
42+
# we simply add a line-feed to the input if it needs one.
43+
if not atom_block.endswith("\n"):
44+
atom_block += "\n"
3945
formatter = "{:>10s}" * 3 + "{:>2}{:>4s}" + "{:>3s}" * 11
4046
chgs = [] # list of charges
4147
lines = atom_block.split("\n")

test-data/atom-block-a-out.sdf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
1 2 1 0
1010
2 3 2 0
1111
2 4 1 0
12-
M CHG 1 4 -1
12+
M CHG 1 4 -1
13+
M END

tests/test_misc.py renamed to tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pathlib
33
import unittest
44

5-
from dm_job_utilities.misc import (
5+
from dm_job_utilities.utils import (
66
calc_geometric_mean,
77
is_type,
88
read_delimiter,

0 commit comments

Comments
 (0)