Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5e22d55
Add the Session.virtualfile_from_stringio function to support StringI…
seisman Jul 11, 2024
f75844e
Let virtualfile_in support the stringio kind
seisman Jul 11, 2024
50467b5
Make data_kind support stringio
seisman Jul 11, 2024
14a14e9
Refactor Figure.legend to support stringio
seisman Jul 11, 2024
37c3c2f
Add a legend test for StringIO input
seisman Jul 11, 2024
4e2e545
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 17, 2024
8e1a609
Some updates
seisman Jul 17, 2024
55d6e81
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 20, 2024
b3b2cb9
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 21, 2024
89757ec
Fix styling issue
seisman Jul 21, 2024
0489783
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 22, 2024
791e4f6
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 24, 2024
5f4d21f
Updates
seisman Jul 24, 2024
1a2d336
Merge branch 'main' into api/virtualfile-from-stringio
seisman Jul 26, 2024
3682098
Improve Figure.legend
seisman Jul 26, 2024
21b2496
Merge branch 'main' into api/virtualfile-from-stringio
seisman Sep 11, 2024
146e430
Fix legend
seisman Sep 11, 2024
c589a40
Updates
seisman Sep 11, 2024
ff90b2e
Figure.legend: Refactor to simplify the logic of checking legend spec…
seisman Sep 11, 2024
90455c1
Merge remote-tracking branch 'origin/refactor/legend' into api/virtua…
seisman Sep 12, 2024
4e4bd2d
FIx
seisman Sep 12, 2024
deb917d
Revert changes in legend
seisman Sep 12, 2024
49fa805
Merge branch 'main' into api/virtualfile-from-stringio
seisman Sep 12, 2024
97bbe05
Merge branch 'main' into api/virtualfile-from-stringio
seisman Sep 13, 2024
dece315
Improve docstrings
seisman Sep 13, 2024
486fce7
Support mutli-segment stringio input
seisman Sep 13, 2024
021a97a
Revert "Support mutli-segment stringio input"
seisman Sep 13, 2024
f6da405
Remove the leading '>' from header
seisman Sep 13, 2024
824d861
Also need to set the header pointer to None
seisman Sep 13, 2024
640e9a9
Support mutli-segment stringio input
seisman Sep 13, 2024
3161963
Update docstrings
seisman Sep 13, 2024
026f6e4
Fix a bug in n_rows
seisman Sep 13, 2024
850337e
Add some tests
seisman Sep 13, 2024
ed20118
Fix static type checking
seisman Sep 13, 2024
f1b5f08
Improve the tests
seisman Sep 13, 2024
e10cef6
Simplify the checking of segment header
seisman Sep 13, 2024
22d4d55
Merge branch 'main' into api/virtualfile-from-stringio
seisman Sep 16, 2024
5ef08e3
Merge branch 'main' into api/virtualfile-from-stringio
seisman Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve docstrings
  • Loading branch information
seisman committed Sep 13, 2024
commit dece315340f5d3b6fe89f689d05e219665698762
11 changes: 7 additions & 4 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,12 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
Store the contents of a :class:`io.StringIO` object in a GMT_DATASET container
and create a virtual file to pass to a GMT module.

For simplicity, currently we make following assumptions in the stringio object

- ``"#"`` indicates a comment line.
- ``">"`` indicates a segment header.
- The object only contains one table and one segment.

Parameters
----------
stringio
Expand All @@ -1633,6 +1639,7 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
--------
>>> import io
>>> from pygmt.clib import Session
>>> # A StringIO object containing legend specifications
>>> stringio = io.StringIO(
... "# Comment\n"
... "H 24p Legend\n"
Expand All @@ -1648,10 +1655,6 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
2 S 0.1i c 0.15i p300/12 0.25p 0.3i My circle
"""
# Parse the strings in the io.StringIO object.
# For simplicity, we make a few assumptions.
# - "#" indicates a comment line
# - ">" indicates a segment header
# - Only one table and one segment
header = None
string_arrays = []
for line in stringio.getvalue().splitlines():
Expand Down