File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def to_string(
15
15
prefix : str = "" , # Default to an empty string to simplify the code logic.
16
16
separator : Literal ["/" , "," ] | None = None ,
17
17
mapping : bool | Mapping = False ,
18
- ) -> str | Sequence [str ] | None :
18
+ ) -> str | list [str ] | None :
19
19
"""
20
20
Convert any value to a string, a sequence of strings or None.
21
21
@@ -100,11 +100,9 @@ def to_string(
100
100
# Convert a sequence of values to a sequence of strings.
101
101
# In some cases, "prefix" and "mapping" are ignored. We can enable them when needed.
102
102
_values = [str (item ) for item in value ]
103
- if separator is None :
104
- # Sequence is given but separator is not specified. Return a sequence of strings
105
- # for repeatable GMT options like '-B'.
106
- return _values
107
- return f"{ prefix } { separator .join (_values )} "
103
+ # When separator is not specified, return a sequence of strings for repeatable GMT
104
+ # options like '-B'. Otherwise, join the sequence of strings with the separator.
105
+ return _values if separator is None else f"{ prefix } { separator .join (_values )} "
108
106
109
107
110
108
@dataclasses .dataclass
You can’t perform that action at this time.
0 commit comments