File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,19 @@ def parse_version(v: str | float) -> tuple[int, int]:
6161
6262
6363def try_split (v : str | Sequence [str ], split_regex : str = "[,]" ) -> list [str ]:
64- """Split and trim a str or list of str into a list of str"""
64+ """Split and trim a str or sequence (eg: list) of str into a list of str.
65+ Non-str elements will simply be returned untouched. This is not documented
66+ by the types but there was no type error before this bugfix, so we must be
67+ type-ignoring elsewhere. Feel free to fix that."""
6568 if isinstance (v , str ):
6669 items = [p .strip () for p in re .split (split_regex , v )]
6770 if items and items [- 1 ] == "" :
6871 items .pop (- 1 )
6972 return items
70- return [p .strip () for p in v ]
73+ elif isinstance (v , Sequence ):
74+ return [p .strip () if isinstance (p , str ) else p for p in v ]
75+ else :
76+ return v
7177
7278
7379def validate_codes (codes : list [str ]) -> list [str ]:
You can’t perform that action at this time.
0 commit comments