I get errors in PEP8 for many of the functions of the form:
def tweet_string(tweet):
"""Return a string representing a tweet."""
location = tweet_location(tweet)
point = (latitude(location), longitude(location))
return '"{0}" @ {1}'.format(tweet_text(tweet), point)
pep8 E128: Continuation line under-indented for visual indent
and
def group_by_key(pairs):
"""Return a dictionary that relates each unique key in [key, value] pairs
to a list of all values that appear paired with that key.
Arguments:
pairs -- a sequence of pairs
>>> example = [ [1, 2], [3, 2], [2, 4], [1, 3], [3, 1], [1, 2] ]
>>> group_by_key(example)
{1: [2, 3, 2], 2: [4], 3: [2, 1]}
"""
# Optional: This implementation is slow because it traverses the list of
# pairs one time for each key. Can you improve it?
keys = [key for key, _ in pairs]
return {key: [y for x, y in pairs if x == key] for key in keys}
pep8 E122: Continuation line missing indentation or outdented
How can I fix this? I've looked everywhere but can't find a solution to 122 and not sure about 128.