Skip to content

Commit

Permalink
Use fast whitespace split if no quoted values are in line
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Dec 18, 2024
1 parent 0acb143 commit 6efccc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/biotite/structure/io/pdbx/cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -1061,6 +1061,9 @@ def _split_one_line(line):
word, _, line = stripped_line[1:].partition(separator)

yield word
else:
# No quoted values in the line -> simple whitespace split
iter(line.split())


def _arrayfy(data):
Expand Down

0 comments on commit 6efccc0

Please sign in to comment.