Skip to content

Commit de16fdd

Browse files
committed
v1.0.7
1 parent 81a07d7 commit de16fdd

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ def tssplit(s, quote='"\'', quote_keep=False, delimiter=':;,', escape='/^', trim
3333
```Python3
3434
from tssplit import tssplit
3535

36-
tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
36+
tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
3737
quote='"\'', delimiter=':;,', escape='/^', trim='')
3838
['--', '--', '--', '----/------:----"----']
3939

40-
tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
40+
tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
4141
quote='"\'', delimiter=':;,', escape='/^', trim='', quote_keep=True)
4242
['--', '--', '--', '--"--/--"--\'--:--\'--"----']
4343

44-
tssplit('--:--;--,--"--/--"--\'--:--\'--# Ignore this',
44+
tssplit('--:--;--,--"--/--"--\'--:--\'--# Ignore this',
4545
quote='"\'', delimiter=':;,', escape='/^', trim='', quote_keep=True, remark='#')
4646
['--', '--', '--', '--"--/--"--\'--:--\'--']
4747
```
@@ -53,5 +53,6 @@ tssplit('--:--;--,--"--/--"--\'--:--\'--# Ignore this',
5353
* 2020.03.29 v1.0.2 Minor fixes, Readme update, Long description provided
5454
* 2020.03.29 v1.0.3 Trim option to strip() characters from chunks
5555
* 2020.03.29 v1.0.4 Multiple characters for quotes, delimiters and escapes
56-
* 2022.02.04 v1.0.5 Added `quote_keep` option to preserve quote marks in the output or not
56+
* 2022.02.04 v1.0.5 Added `quote_keep` option to preserve quote marks in the output or not
5757
* 2023.01.12 v1.0.6 Remark characters interrupt string parsing
58+
* 2024.04.03 v1.0.7 Cosmetics to make pylint happy

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
"""Trivial split for strings with multiple character delimiters, quotes and escaped characters"""
2+
13
from setuptools import setup
24

3-
with open("README.md", "r") as fh:
5+
with open("README.md", "r", encoding="utf-8") as fh:
46
long_description = fh.read()
57

68
setup(

tssplit/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from tssplit.tssplit import tssplit
1+
"""Trivial split for strings with multiple character delimiters, quotes and escaped characters"""
2+
3+
from tssplit.tssplit import tssplit

tssplit/tssplit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
"""Trivial split for strings with multiple character delimiters, quotes and escaped characters"""
2+
13
def tssplit(s, quote='"\'', quote_keep=False, delimiter=':;,', escape='/^', trim='', remark='#'):
4+
# pylint: disable-msg=too-many-locals
5+
26
"""Split a string by delimiters with quotes and escaped characters, optionally trimming results
37
48
:param s: A string to split into chunks
@@ -24,7 +28,7 @@ def tssplit(s, quote='"\'', quote_keep=False, delimiter=':;,', escape='/^', trim
2428
if in_quotes:
2529
token += c
2630
elif c in quote and not in_escape:
27-
in_quotes = False if in_quotes else True
31+
in_quotes = not in_quotes
2832
if quote_keep:
2933
token += c
3034
elif c in delimiter and not in_quotes:

0 commit comments

Comments
 (0)