Skip to content

Commit 333d1db

Browse files
committed
Simplify code for attribute docstrings
1 parent cef76e9 commit 333d1db

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tap/utils.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,13 @@ def get_class_variables(cls: type) -> OrderedDict:
235235
if token['token'].strip() == '':
236236
continue
237237

238-
# Extract multiline comments in triple quote
239-
if (class_variable is not None
240-
and token['token_type'] == tokenize.STRING
241-
and token['token'][:3] in {'"""', "'''"}):
242-
sep = ' ' if variable_to_comment[class_variable]['comment'] else ''
243-
variable_to_comment[class_variable]['comment'] += sep + token['token'][3:-3].strip()
244-
continue
245-
246-
# Extract multiline comments in single quote
238+
# Extract multiline comments
247239
if (class_variable is not None
248240
and token['token_type'] == tokenize.STRING
249241
and token['token'][:1] in {'"', "'"}):
250242
sep = ' ' if variable_to_comment[class_variable]['comment'] else ''
251-
variable_to_comment[class_variable]['comment'] += sep + token['token'][1:-1].strip()
252-
continue
243+
quote_char = token['token'][:1]
244+
variable_to_comment[class_variable]['comment'] += sep + token['token'].strip(quote_char).strip()
253245

254246
# Match class variable
255247
class_variable = None

0 commit comments

Comments
 (0)