Make key_split play nice with string representations of tuples lacking a
hyphen
@@ -481,6 +481,8 @@ def key_split(s):
'x'
>>> key_split("('x-2', 1)")
'x'
+ >>> key_split("('x', 1)")
+ 'x'
>>> key_split('hello-world-1')
'hello-world'
>>> key_split(b'hello-world-1')
@@ -501,7 +503,7 @@ def key_split(s):
try:
words = s.split('-')
if not words[0][0].isalpha():
- result = words[0].lstrip("'(\"")
+ result = words[0].split(",")[0].strip("'(\"")
else:
result = words[0]
for word in words[1:]:
