|
10 | 10 | from pygmt.helpers.utils import is_nonstr_iter, sequence_join |
11 | 11 |
|
12 | 12 |
|
13 | | -def to_string( |
| 13 | +def _to_string( |
14 | 14 | value: Any, |
15 | 15 | prefix: str = "", # Default to an empty string to simplify the code logic. |
16 | 16 | mapping: bool | Mapping = False, |
@@ -61,29 +61,29 @@ def to_string( |
61 | 61 |
|
62 | 62 | Examples |
63 | 63 | -------- |
64 | | - >>> to_string("text") |
| 64 | + >>> _to_string("text") |
65 | 65 | 'text' |
66 | | - >>> to_string(12) |
| 66 | + >>> _to_string(12) |
67 | 67 | '12' |
68 | | - >>> to_string((12, 34), separator="/") |
| 68 | + >>> _to_string((12, 34), separator="/") |
69 | 69 | '12/34' |
70 | | - >>> to_string(("12p", "34p"), separator=",") |
| 70 | + >>> _to_string(("12p", "34p"), separator=",") |
71 | 71 | '12p,34p' |
72 | | - >>> to_string(("12p", "34p"), prefix="+o", separator="/") |
| 72 | + >>> _to_string(("12p", "34p"), prefix="+o", separator="/") |
73 | 73 | '+o12p/34p' |
74 | | - >>> to_string(True) |
| 74 | + >>> _to_string(True) |
75 | 75 | '' |
76 | | - >>> to_string(True, prefix="+a") |
| 76 | + >>> _to_string(True, prefix="+a") |
77 | 77 | '+a' |
78 | | - >>> to_string(False) |
79 | | - >>> to_string(None) |
80 | | - >>> to_string(["xaf", "yaf", "WSen"]) |
| 78 | + >>> _to_string(False) |
| 79 | + >>> _to_string(None) |
| 80 | + >>> _to_string(["xaf", "yaf", "WSen"]) |
81 | 81 | ['xaf', 'yaf', 'WSen'] |
82 | | - >>> to_string("high", mapping=True) |
| 82 | + >>> _to_string("high", mapping=True) |
83 | 83 | 'h' |
84 | | - >>> to_string("mean", mapping={"mean": "a", "mad": "d", "full": "g"}) |
| 84 | + >>> _to_string("mean", mapping={"mean": "a", "mad": "d", "full": "g"}) |
85 | 85 | 'a' |
86 | | - >>> to_string("invalid", mapping={"mean": "a", "mad": "d", "full": "g"}) |
| 86 | + >>> _to_string("invalid", mapping={"mean": "a", "mad": "d", "full": "g"}) |
87 | 87 | 'invalid' |
88 | 88 | """ |
89 | 89 | if value is None or value is False: # None and False are converted to None. |
@@ -157,7 +157,7 @@ def _value(self) -> str | list[str] | None: |
157 | 157 | """ |
158 | 158 | The value of the alias as a string, a sequence of strings or None. |
159 | 159 | """ |
160 | | - return to_string( |
| 160 | + return _to_string( |
161 | 161 | value=self.value, |
162 | 162 | prefix=self.prefix, |
163 | 163 | separator=self.separator, |
|
0 commit comments