Permalink
Browse files

Allow sphinx.ext.autodoc syntax for comments. Issue #110

  • Loading branch information...
1 parent 44e8c91 commit 5d7dbef4f904123b40a9b76a41fb08aa1e3a1d03 @florentx florentx committed Dec 25, 2012
Showing with 10 additions and 2 deletions.
  1. +1 −1 CHANGES.txt
  2. +2 −1 pep8.py
  3. +7 −0 testsuite/E26.py
View
@@ -5,7 +5,7 @@ Changelog
1.x (unreleased)
----------------
-* ...
+* Allow sphinx.ext.autodoc syntax for comments. (Issue #110)
1.4 (2012-12-22)
View
@@ -796,7 +796,8 @@ def whitespace_before_inline_comment(logical_line, tokens):
if prev_end[0] == start[0] and start[1] < prev_end[1] + 2:
yield (prev_end,
"E261 at least two spaces before inline comment")
- if text.startswith('# ') or not text.startswith('# '):
+ symbol, sp, comment = text.partition(' ')
+ if symbol not in ('#', '#:') or comment[:1].isspace():
yield start, "E262 inline comment should start with '# '"
elif token_type != tokenize.NL:
prev_end = end
View
@@ -4,3 +4,10 @@
x = x + 1 #Increment x
#: E262
x = x + 1 # Increment x
+#: E262
+x = y + 1 #: Increment x
+#: Okay
+pass # an inline comment
+x = x + 1 # Increment x
+y = y + 1 #: Increment x
+#:

1 comment on commit 5d7dbef

@jdahlin

Thanks for solving this.

Please sign in to comment.