Skip to content

Commit

Permalink
Slight speedup of split_line
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Sep 15, 2024
1 parent 59e11a8 commit 1645654
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/omnipy/modules/raw/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ class Params(ParamsBase):

@classmethod
def _split_line(cls, data: str) -> list[str]:
if cls.Params.strip:
data = data.strip(cls.Params.strip_chars)
strip = cls.Params.strip
strip_chars = cls.Params.strip_chars
delimiter = cls.Params.delimiter

if strip:
data = data.strip(strip_chars)

items = data.split(cls.Params.delimiter)
return [item.strip(cls.Params.strip_chars) for item in items] if cls.Params.strip else items
items = data.split(delimiter)
return [item.strip(strip_chars) for item in items] if strip else items


class _SplitToItemsModel(
Expand Down

0 comments on commit 1645654

Please sign in to comment.