Skip to content

Commit a3aadea

Browse files
author
Zach Smith
committed
Formatting cleanup after merge.
1 parent 17391b9 commit a3aadea

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

pycco/main.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,32 +100,32 @@ def save(docs, code):
100100

101101
for line in lines:
102102
process_as_code = False
103-
104103
# Only go into multiline comments section when one of the delimiters is
105104
# found to be at the start of a line
106-
if multistart and multiend and \
107-
any(line.lstrip().startswith(delim) or line.rstrip().endswith(delim)
108-
for delim in (multistart, multiend)):
105+
if multistart and multiend \
106+
and any(line.lstrip().startswith(delim) or line.rstrip().endswith(delim)
107+
for delim in (multistart, multiend)):
109108
multi_line = not multi_line
110109

111-
if (multi_line
112-
and line.strip().endswith(multiend)
113-
and len(line.strip()) > len(multiend)):
110+
if multi_line \
111+
and line.strip().endswith(multiend) \
112+
and len(line.strip()) > len(multiend):
114113
multi_line = False
115114

116-
117-
if((not line.strip().startswith(multistart) and not multi_line) or multi_string):
115+
if not line.strip().startswith(multistart) and not multi_line \
116+
or multi_string:
118117

119118
process_as_code = True
120119

121-
if(multi_string):
120+
if multi_string:
122121
multi_line = False
123122
multi_string = False
124123
else:
125124
multi_string = True
126125

127126
else:
128-
# Get rid of the delimiters so that they aren't in the final docs
127+
# Get rid of the delimiters so that they aren't in the final
128+
# docs
129129
line = line.replace(multistart, '')
130130
line = line.replace(multiend, '')
131131
docs_text += line.strip() + '\n'
@@ -152,8 +152,7 @@ def save(docs, code):
152152
else:
153153
process_as_code = True
154154

155-
if(process_as_code):
156-
155+
if process_as_code:
157156
if code_text and any(line.lstrip().startswith(x)
158157
for x in ['class ', 'def ', '@']):
159158
if not code_text.lstrip().startswith("@"):
@@ -516,6 +515,7 @@ def monitor(sources, opts):
516515
for source in sources)
517516

518517
class RegenerateHandler(watchdog.events.FileSystemEventHandler):
518+
519519
"""A handler for recompiling files which triggered watchdog events"""
520520

521521
def on_modified(self, event):

tests/test_pycco.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_comment_with_only_cross_ref():
6464
source = '''# ==Link Target==\n\ndef test_link():\n """[[testing.py#link-target]]"""\n pass'''
6565
sections = p.parse(source, PYTHON)
6666
p.highlight(sections, PYTHON, outdir=tempfile.gettempdir())
67-
assert sections[1]['docs_html'] == '<p><a href="testing.html#link-target">testing.py</a></p>'
67+
assert sections[1]['docs_html'] == '<p><a href="testing.html#link-target">testing.py</a></p>'
6868

6969

7070
@given(text(), text())
@@ -124,19 +124,18 @@ def test_process(preserve_paths, choice):
124124

125125
def test_ensure_multiline_string_support():
126126
code = '''x = """
127-
how about this?
127+
multi-line-string
128128
"""
129129
130-
y = z # is this where it should be?
130+
y = z # comment
131131
132-
# how did this get so *BIG!*
132+
# *comment with formatting*
133133
134134
def x():
135-
"""how would you fix?
135+
"""multi-line-string
136136
"""'''
137137

138-
docs_code_tuple_list = p.parse(code,PYTHON)
138+
docs_code_tuple_list = p.parse(code, PYTHON)
139139

140140
assert docs_code_tuple_list[0]['docs_text'] == ''
141-
assert "#" not in docs_code_tuple_list[1]['docs_text']
142-
141+
assert "#" not in docs_code_tuple_list[1]['docs_text']

0 commit comments

Comments
 (0)