summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Smith <zach.smith@makespace.com>2015-11-19 20:05:29 -0500
committerZach Smith <zach.smith@makespace.com>2015-11-19 20:05:29 -0500
commita3aadea52010e2c3e328e58b4d728a0f9c100113 (patch)
tree25a1d05f9a823e002e1a6d153ad5fa5217a007c7
parent17391b9c0f1a6b1ed5f062ba85a23a3511155678 (diff)
downloadpycco-a3aadea52010e2c3e328e58b4d728a0f9c100113.tar.gz
Formatting cleanup after merge.
-rw-r--r--pycco/main.py26
-rw-r--r--tests/test_pycco.py15
2 files changed, 20 insertions, 21 deletions
diff --git a/pycco/main.py b/pycco/main.py
index e99d4bb..c9a3612 100644
--- a/pycco/main.py
+++ b/pycco/main.py
@@ -100,32 +100,32 @@ def parse(code, language):
for line in lines:
process_as_code = False
-
# Only go into multiline comments section when one of the delimiters is
# found to be at the start of a line
- if multistart and multiend and \
- any(line.lstrip().startswith(delim) or line.rstrip().endswith(delim)
- for delim in (multistart, multiend)):
+ if multistart and multiend \
+ and any(line.lstrip().startswith(delim) or line.rstrip().endswith(delim)
+ for delim in (multistart, multiend)):
multi_line = not multi_line
- if (multi_line
- and line.strip().endswith(multiend)
- and len(line.strip()) > len(multiend)):
+ if multi_line \
+ and line.strip().endswith(multiend) \
+ and len(line.strip()) > len(multiend):
multi_line = False
-
- if((not line.strip().startswith(multistart) and not multi_line) or multi_string):
+ if not line.strip().startswith(multistart) and not multi_line \
+ or multi_string:
process_as_code = True
- if(multi_string):
+ if multi_string:
multi_line = False
multi_string = False
else:
multi_string = True
else:
- # Get rid of the delimiters so that they aren't in the final docs
+ # Get rid of the delimiters so that they aren't in the final
+ # docs
line = line.replace(multistart, '')
line = line.replace(multiend, '')
docs_text += line.strip() + '\n'
@@ -152,8 +152,7 @@ def parse(code, language):
else:
process_as_code = True
- if(process_as_code):
-
+ if process_as_code:
if code_text and any(line.lstrip().startswith(x)
for x in ['class ', 'def ', '@']):
if not code_text.lstrip().startswith("@"):
@@ -516,6 +515,7 @@ def monitor(sources, opts):
for source in sources)
class RegenerateHandler(watchdog.events.FileSystemEventHandler):
+
"""A handler for recompiling files which triggered watchdog events"""
def on_modified(self, event):
diff --git a/tests/test_pycco.py b/tests/test_pycco.py
index d0cf6a3..8136c03 100644
--- a/tests/test_pycco.py
+++ b/tests/test_pycco.py
@@ -64,7 +64,7 @@ def test_comment_with_only_cross_ref():
source = '''# ==Link Target==\n\ndef test_link():\n """[[testing.py#link-target]]"""\n pass'''
sections = p.parse(source, PYTHON)
p.highlight(sections, PYTHON, outdir=tempfile.gettempdir())
- assert sections[1]['docs_html'] == '<p><a href="testing.html#link-target">testing.py</a></p>'
+ assert sections[1]['docs_html'] == '<p><a href="testing.html#link-target">testing.py</a></p>'
@given(text(), text())
@@ -124,19 +124,18 @@ def test_process(preserve_paths, choice):
def test_ensure_multiline_string_support():
code = '''x = """
-how about this?
+multi-line-string
"""
-y = z # is this where it should be?
+y = z # comment
-# how did this get so *BIG!*
+# *comment with formatting*
def x():
- """how would you fix?
+ """multi-line-string
"""'''
- docs_code_tuple_list = p.parse(code,PYTHON)
+ docs_code_tuple_list = p.parse(code, PYTHON)
assert docs_code_tuple_list[0]['docs_text'] == ''
- assert "#" not in docs_code_tuple_list[1]['docs_text']
-
+ assert "#" not in docs_code_tuple_list[1]['docs_text']