Skip to content

Commit

Permalink
Fix handling '/' in _get_num_cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Nov 29, 2024
1 parent 2543b2c commit 5b0b66d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/ert/config/_get_num_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def _get_num_cpu(
"""
parser = _Parser(lines_iter)
slaves_num_cpu = None
try:
slaves_num_cpu = None
while (words := parser.next_line(None)) is not None:
if not words:
continue
Expand Down Expand Up @@ -177,6 +177,18 @@ def _split_line(line: str) -> Iterator[str]:
>>> list(_split_line("3 1.0 3*4 PORO 3*INC 'HELLO WORLD ' 3*'NAME'"))
['3', '1.0', '3*4', 'PORO', '3*INC', 'HELLO WORLD ', '3*', 'NAME']
>>> list(_split_line("KEYWORD 3.14/"))
['KEYWORD', '3.14', '/']
>>> list(_split_line("KEYWORD '3.14/'"))
['KEYWORD', '3.14/']
>>> list(_split_line("KEYWORD '3.14'/"))
['KEYWORD', '3.14', '/']
>>> list(_split_line("ALLPROPS/"))
['ALLPROPS', '/']
>>> list(_split_line("ALLPROPS -- A comment"))
['ALLPROPS']
>>> list(_split_line("ALLPROPS / Also a comment"))
['ALLPROPS', '/']
"""
value = ""
inside_str = None
Expand All @@ -199,6 +211,13 @@ def _split_line(line: str) -> Iterator[str]:
# a comment
value = value[0:-1]
break
elif char == "/":
# End of statement
if value:
yield value
value = ""
yield "/"
break
elif char.isspace():
# delimiting space
if value:
Expand Down

0 comments on commit 5b0b66d

Please sign in to comment.