Skip to content

Commit

Permalink
Normalize leading whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed May 2, 2015
1 parent 49268ae commit 97defeb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions emailtunnel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def sanity_check(a, b):
def sanity_strip(data):
data = re.sub(b': *', b': ', data)
lines = re.split(br'[\r\n]+', data.rstrip())
# Replace leading whitespace by a single space
lines = [b' ' + line.lstrip() if line.lstrip() != line else line
for line in lines]
return tuple(line.rstrip() for line in lines)

def _sanity_log_invalid(self, message):
Expand Down

0 comments on commit 97defeb

Please sign in to comment.