From 88bdf5091bc448894800f2d196c18dd99357be1c Mon Sep 17 00:00:00 2001 From: Patrick Kunzmann Date: Wed, 18 Dec 2024 17:09:50 +0100 Subject: [PATCH] Use fast whitespace split if no quoted values are in line --- src/biotite/structure/io/pdbx/cif.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/biotite/structure/io/pdbx/cif.py b/src/biotite/structure/io/pdbx/cif.py index 94557ca11..dacae13a8 100644 --- a/src/biotite/structure/io/pdbx/cif.py +++ b/src/biotite/structure/io/pdbx/cif.py @@ -1041,8 +1041,8 @@ def _split_one_line(line): # Special case of multiline value, where the line starts with ';' if line[0] == ";": yield line[1:] - else: - # Loop over the line + elif "'" in line or '"' in line: + # Quoted values in the line while line: # Strip leading whitespace(s) stripped_line = line.lstrip() @@ -1061,6 +1061,10 @@ def _split_one_line(line): word, _, line = stripped_line[1:].partition(separator) yield word + else: + # No quoted values in the line -> simple whitespace split + for line in line.split(): + yield line def _arrayfy(data):