161 (boolean) |
161 (boolean) |
162 @keyparam maxLineLength allowed line length (integer) |
162 @keyparam maxLineLength allowed line length (integer) |
163 @keyparam docType type of the documentation strings |
163 @keyparam docType type of the documentation strings |
164 (string, one of 'eric' or 'pep257') |
164 (string, one of 'eric' or 'pep257') |
165 """ |
165 """ |
166 assert docType in ("eric", "pep257") |
|
167 |
|
168 self.__select = tuple(select) |
166 self.__select = tuple(select) |
169 self.__ignore = ('',) if select else tuple(ignore) |
167 self.__ignore = ('',) if select else tuple(ignore) |
170 self.__expected = expected[:] |
168 self.__expected = expected[:] |
171 self.__repeat = repeat |
169 self.__repeat = repeat |
172 self.__maxLineLength = maxLineLength |
170 self.__maxLineLength = maxLineLength |
851 if docstringContext is None: |
849 if docstringContext is None: |
852 return |
850 return |
853 |
851 |
854 lines = docstringContext.source() |
852 lines = docstringContext.source() |
855 if len(lines) > 1: |
853 if len(lines) > 1: |
856 nonEmptyLines = [l for l in lines if l.strip().strip('\'"')] |
854 nonEmptyLines = [line for line in lines |
|
855 if line.strip().strip('\'"')] |
857 if len(nonEmptyLines) == 1: |
856 if len(nonEmptyLines) == 1: |
858 modLen = len(context.indent() + '"""' + |
857 modLen = len(context.indent() + '"""' + |
859 nonEmptyLines[0].strip() + '"""') |
858 nonEmptyLines[0].strip() + '"""') |
860 if context.contextType() != "module": |
859 if context.contextType() != "module": |
861 modLen += 4 |
860 modLen += 4 |
877 |
876 |
878 lines = docstringContext.source() |
877 lines = docstringContext.source() |
879 if len(lines) == 1: |
878 if len(lines) == 1: |
880 return |
879 return |
881 |
880 |
882 nonEmptyLines = [l.rstrip() for l in lines[1:] if l.strip()] |
881 nonEmptyLines = [line.rstrip() for line in lines[1:] if line.strip()] |
883 if not nonEmptyLines: |
882 if not nonEmptyLines: |
884 return |
883 return |
885 |
884 |
886 indent = min(len(l) - len(l.strip()) for l in nonEmptyLines) |
885 indent = min(len(line) - len(line.strip()) for line in nonEmptyLines) |
887 if context.contextType() == "module": |
886 if context.contextType() == "module": |
888 expectedIndent = 0 |
887 expectedIndent = 0 |
889 else: |
888 else: |
890 expectedIndent = len(context.indent()) + 4 |
889 expectedIndent = len(context.indent()) + 4 |
891 if indent != expectedIndent: |
890 if indent != expectedIndent: |