Permalink
Browse files

Treat comments and doc strings separately when wrapping and left-just…

…ifying them
  • Loading branch information...
1 parent 4b8d9a5 commit d07c4bc69b0ab06016d050658cecdffefb232207 @witsch committed Sep 24, 2011
Showing with 8 additions and 2 deletions.
  1. +4 −2 PythonTidy.py
  2. +4 −0 PythonTidyWrapper.py
View
@@ -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
@@ -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)
@@ -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:
View
@@ -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'),

0 comments on commit d07c4bc

Please sign in to comment.