@@ -1618,11 +1618,10 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
1618
1618
Store the contents of a :class:`io.StringIO` object in a GMT_DATASET container
1619
1619
and create a virtual file to pass to a GMT module.
1620
1620
1621
- For simplicity, currently we make following assumptions in the stringio object
1621
+ For simplicity, currently we make following assumptions in the StringIO object
1622
1622
1623
1623
- ``"#"`` indicates a comment line.
1624
1624
- ``">"`` indicates a segment header.
1625
- - The object only contains one table.
1626
1625
1627
1626
Parameters
1628
1627
----------
@@ -1654,7 +1653,7 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
1654
1653
1 N 2
1655
1654
2 S 0.1i c 0.15i p300/12 0.25p 0.3i My circle
1656
1655
"""
1657
- # Parse the strings in the io.StringIO object.
1656
+ # Parse the io.StringIO object.
1658
1657
segments = []
1659
1658
current_segment = {"header" : "" , "data" : []}
1660
1659
for line in stringio .getvalue ().splitlines ():
@@ -1664,7 +1663,7 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
1664
1663
if current_segment ["data" ]: # If we have data, start a new segment
1665
1664
segments .append (current_segment )
1666
1665
current_segment = {"header" : "" , "data" : []}
1667
- current_segment ["header" ] = line .strip (">" ).strip ()
1666
+ current_segment ["header" ] = line .strip (">" ).lstrip ()
1668
1667
else :
1669
1668
current_segment ["data" ].append (line )
1670
1669
if current_segment ["data" ]: # Add the last segment if it has data
@@ -1676,6 +1675,7 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
1676
1675
n_rows = sum (len (segment ["data" ]) for segment in segments )
1677
1676
n_columns = 0
1678
1677
1678
+ # Create the GMT_DATASET container
1679
1679
family , geometry = "GMT_IS_DATASET" , "GMT_IS_TEXT"
1680
1680
dataset = self .create_data (
1681
1681
family ,
0 commit comments