summaryrefslogtreecommitdiff
path: root/src/flake8
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-07-28 10:39:27 -0400
committerEric N. Vander Weele <ericvw@gmail.com>2019-07-28 10:43:06 -0400
commit1757bce321c8276b6fad77ce15766f0c81e46957 (patch)
tree0aadd9cc9ec1c5c2f2ec0d528030d05262018589 /src/flake8
parentf01011a403fd806571b8b0fa172ec39f54bb9e83 (diff)
downloadflake8-1757bce321c8276b6fad77ce15766f0c81e46957.tar.gz
utils: Tighten `parse_comma_separated_list()` contract further
Now that callers are ensuring that `value` is not `None`, we can further tighten the contract and remove the conditional to account when `None` is passed-in for `value`. Additionally, add a new test vector to account for when an empty string is passed in, which would fail `if no value`.
Diffstat (limited to 'src/flake8')
-rw-r--r--src/flake8/utils.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index 619c83d..92fec71 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -24,7 +24,7 @@ string_types = (str, type(u""))
def parse_comma_separated_list(value, regexp=COMMA_SEPARATED_LIST_RE):
- # type: (Optional[str], Pattern[str]) -> List[str]
+ # type: (str, Pattern[str]) -> List[str]
"""Parse a comma-separated list.
:param value:
@@ -41,9 +41,6 @@ def parse_comma_separated_list(value, regexp=COMMA_SEPARATED_LIST_RE):
"""
assert isinstance(value, string_types), value # nosec (for bandit)
- if not value:
- return []
-
separated = regexp.split(value)
item_gen = (item.strip() for item in separated)
return [item for item in item_gen if item]