Skip to content

Commit

Permalink
Treat comments and doc strings separately when wrapping and left-just…
Browse files Browse the repository at this point in the history
…ifying them
  • Loading branch information
witsch committed Sep 24, 2011
1 parent 4b8d9a5 commit d07c4bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PythonTidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@
NORMALIZE_DOC_STRINGS = False
LEFTJUST_DOC_STRINGS = False
WRAP_DOC_STRINGS = False # 2007 May 25
LEFTJUST_COMMENTS = False
WRAP_COMMENTS = False
DOUBLE_QUOTED_STRINGS = False # 2006 Dec 05
SINGLE_QUOTED_STRINGS = False # 2007 May 01
RECODE_STRINGS = False # 2006 Dec 01
Expand Down Expand Up @@ -1298,7 +1300,7 @@ def strip_blank_lines(text_lines):
text.append([scol, token_string]) # 2007 May 25
on1 = False
self.prev_lineno += 1
if text and LEFTJUST_DOC_STRINGS: # 2007 May 25
if text and LEFTJUST_COMMENTS: # 2007 May 25
(first, last, is_first_blank, is_last_blank) = strip_blank_lines(text)
lines = [line for (scol, line) in text[first: last]]
lines = leftjust_lines(lines)
Expand All @@ -1307,7 +1309,7 @@ def strip_blank_lines(text_lines):
text.insert(ZERO, [NA, NULL])
if is_last_blank:
text.append([NA, NULL])
if text and WRAP_DOC_STRINGS: # 2007 May 25
if text and WRAP_COMMENTS: # 2007 May 25
(first, last, is_first_blank, is_last_blank) = strip_blank_lines(text)
text = text[first: last]
if text:
Expand Down
4 changes: 4 additions & 0 deletions PythonTidyWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ def from_pythontidy_namespace(self):
'If true, left justify doc strings.', 'bool'),
('WRAP_DOC_STRINGS',
'If true, wrap doc strings to COL_LIMIT.', 'bool'),
('LEFTJUST_COMMENTS',
'If true, left justify comments.', 'bool'),
('WRAP_COMMENTS',
'If true, wrap comments to COL_LIMIT.', 'bool'),
('DOUBLE_QUOTED_STRINGS',
'If true, use quotes instead of apostrophes for string literals.'
, 'bool'),
Expand Down

0 comments on commit d07c4bc

Please sign in to comment.