diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-02-10 19:30:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 19:30:15 +0100 |
commit | 595ec422d6f9bd32f42c356d2f316ec69e0f7bee (patch) | |
tree | 766a12ddd91b43e09f670f913a4069bc7dc82d57 /pylint/reporters | |
parent | e3d5deca2886d9e2d5f2be2a252e39e02ae42b96 (diff) | |
download | pylint-git-595ec422d6f9bd32f42c356d2f316ec69e0f7bee.tar.gz |
Update ``pydocstringformatter`` to 0.4.0 (#5787)
Diffstat (limited to 'pylint/reporters')
-rw-r--r-- | pylint/reporters/__init__.py | 4 | ||||
-rw-r--r-- | pylint/reporters/base_reporter.py | 14 | ||||
-rw-r--r-- | pylint/reporters/collecting_reporter.py | 2 | ||||
-rw-r--r-- | pylint/reporters/json_reporter.py | 4 | ||||
-rw-r--r-- | pylint/reporters/multi_reporter.py | 12 | ||||
-rw-r--r-- | pylint/reporters/reports_handler_mix_in.py | 10 | ||||
-rw-r--r-- | pylint/reporters/text.py | 26 | ||||
-rw-r--r-- | pylint/reporters/ureports/base_writer.py | 18 | ||||
-rw-r--r-- | pylint/reporters/ureports/nodes.py | 22 | ||||
-rw-r--r-- | pylint/reporters/ureports/text_writer.py | 16 |
10 files changed, 64 insertions, 64 deletions
diff --git a/pylint/reporters/__init__.py b/pylint/reporters/__init__.py index 420154d54..92b6bae21 100644 --- a/pylint/reporters/__init__.py +++ b/pylint/reporters/__init__.py @@ -21,7 +21,7 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -"""utilities methods and classes for reporters""" +"""Utilities methods and classes for reporters.""" from typing import TYPE_CHECKING from pylint import utils @@ -36,7 +36,7 @@ if TYPE_CHECKING: def initialize(linter: "PyLinter") -> None: - """initialize linter with reporters in this package""" + """Initialize linter with reporters in this package.""" utils.register_plugins(linter, __path__[0]) diff --git a/pylint/reporters/base_reporter.py b/pylint/reporters/base_reporter.py index 7ee55beff..570175567 100644 --- a/pylint/reporters/base_reporter.py +++ b/pylint/reporters/base_reporter.py @@ -16,7 +16,7 @@ if TYPE_CHECKING: class BaseReporter: - """base class for reporters + """Base class for reporters. symbols: show short symbolic names for messages. """ @@ -24,7 +24,7 @@ class BaseReporter: extension = "" name = "base" - """Name of the reporter""" + """Name of the reporter.""" def __init__(self, output: Optional[TextIO] = None) -> None: self.linter: "PyLinter" @@ -39,7 +39,7 @@ class BaseReporter: self.messages.append(msg) def set_output(self, output: Optional[TextIO] = None) -> None: - """set output stream""" + """Set output stream.""" # pylint: disable-next=fixme # TODO: Remove this method after depreciation warn( @@ -49,11 +49,11 @@ class BaseReporter: self.out = output or sys.stdout def writeln(self, string: str = "") -> None: - """write a line in the output buffer""" + """Write a line in the output buffer.""" print(string, file=self.out) def display_reports(self, layout: "Section") -> None: - """display results encapsulated in the layout tree""" + """Display results encapsulated in the layout tree.""" self.section = 0 if layout.report_id: if isinstance(layout.children[0].children[0], Text): @@ -63,11 +63,11 @@ class BaseReporter: self._display(layout) def _display(self, layout: "Section") -> None: - """display the layout""" + """Display the layout.""" raise NotImplementedError() def display_messages(self, layout: Optional["Section"]) -> None: - """Hook for displaying the messages of the reporter + """Hook for displaying the messages of the reporter. This will be called whenever the underlying messages needs to be displayed. For some reporters, it probably diff --git a/pylint/reporters/collecting_reporter.py b/pylint/reporters/collecting_reporter.py index 70f313bb3..9b787342a 100644 --- a/pylint/reporters/collecting_reporter.py +++ b/pylint/reporters/collecting_reporter.py @@ -9,7 +9,7 @@ if TYPE_CHECKING: class CollectingReporter(BaseReporter): - """collects messages""" + """Collects messages.""" name = "collector" diff --git a/pylint/reporters/json_reporter.py b/pylint/reporters/json_reporter.py index 8761979aa..5c2074773 100644 --- a/pylint/reporters/json_reporter.py +++ b/pylint/reporters/json_reporter.py @@ -12,7 +12,7 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -"""JSON reporter""" +"""JSON reporter.""" import json from typing import TYPE_CHECKING, Optional @@ -32,7 +32,7 @@ class JSONReporter(BaseReporter): extension = "json" def display_messages(self, layout: Optional["Section"]) -> None: - """Launch layouts display""" + """Launch layouts display.""" json_dumpable = [ { "type": msg.category, diff --git a/pylint/reporters/multi_reporter.py b/pylint/reporters/multi_reporter.py index 61740908d..a68c8c423 100644 --- a/pylint/reporters/multi_reporter.py +++ b/pylint/reporters/multi_reporter.py @@ -18,7 +18,7 @@ PyLinter = Any class MultiReporter: - """Reports messages and layouts in plain text""" + """Reports messages and layouts in plain text.""" __implements__ = IReporter name = "_internal_multi_reporter" @@ -80,22 +80,22 @@ class MultiReporter: rep.handle_message(msg) def writeln(self, string: str = "") -> None: - """write a line in the output buffer""" + """Write a line in the output buffer.""" for rep in self._sub_reporters: rep.writeln(string) def display_reports(self, layout: "Section") -> None: - """display results encapsulated in the layout tree""" + """Display results encapsulated in the layout tree.""" for rep in self._sub_reporters: rep.display_reports(layout) def display_messages(self, layout: Optional["Section"]) -> None: - """hook for displaying the messages of the reporter""" + """Hook for displaying the messages of the reporter.""" for rep in self._sub_reporters: rep.display_messages(layout) def on_set_current_module(self, module: str, filepath: Optional[str]) -> None: - """hook called when a module starts to be analysed""" + """Hook called when a module starts to be analysed.""" for rep in self._sub_reporters: rep.on_set_current_module(module, filepath) @@ -104,6 +104,6 @@ class MultiReporter: stats: LinterStats, previous_stats: LinterStats, ) -> None: - """hook called when a module finished analyzing""" + """Hook called when a module finished analyzing.""" for rep in self._sub_reporters: rep.on_close(stats, previous_stats) diff --git a/pylint/reporters/reports_handler_mix_in.py b/pylint/reporters/reports_handler_mix_in.py index 245d2ded1..01d9947fd 100644 --- a/pylint/reporters/reports_handler_mix_in.py +++ b/pylint/reporters/reports_handler_mix_in.py @@ -34,13 +34,13 @@ class ReportsHandlerMixIn: self._reports_state: Dict[str, bool] = {} def report_order(self) -> MutableSequence["BaseChecker"]: - """Return a list of reporters""" + """Return a list of reporters.""" return list(self._reports) def register_report( self, reportid: str, r_title: str, r_cb: Callable, checker: "BaseChecker" ) -> None: - """Register a report + """Register a report. :param reportid: The unique identifier for the report :param r_title: The report's title @@ -51,12 +51,12 @@ class ReportsHandlerMixIn: self._reports[checker].append((reportid, r_title, r_cb)) def enable_report(self, reportid: str) -> None: - """Enable the report of the given id""" + """Enable the report of the given id.""" reportid = reportid.upper() self._reports_state[reportid] = True def disable_report(self, reportid: str) -> None: - """Disable the report of the given id""" + """Disable the report of the given id.""" reportid = reportid.upper() self._reports_state[reportid] = False @@ -69,7 +69,7 @@ class ReportsHandlerMixIn: stats: LinterStats, old_stats: Optional[LinterStats], ) -> Section: - """Render registered reports""" + """Render registered reports.""" sect = Section("Report", f"{self.stats.statement} statements analysed.") for checker in self.report_order(): for reportid, r_title, r_cb in self._reports[checker]: diff --git a/pylint/reporters/text.py b/pylint/reporters/text.py index b0db63f11..6743ab5b1 100644 --- a/pylint/reporters/text.py +++ b/pylint/reporters/text.py @@ -19,7 +19,7 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -"""Plain text reporters: +"""Plain text reporters:. :text: the default one grouping messages by module :colorized: an ANSI colorized text reporter @@ -53,7 +53,7 @@ if TYPE_CHECKING: class MessageStyle(NamedTuple): - """Styling of a message""" + """Styling of a message.""" color: Optional[str] """The color name (see `ANSI_COLORS` for available values) @@ -93,7 +93,7 @@ ANSI_COLORS = { def _get_ansi_code(msg_style: MessageStyle) -> str: - """return ansi escape code corresponding to color and style + """Return ansi escape code corresponding to color and style. :param msg_style: the message style @@ -173,7 +173,7 @@ def colorize_ansi( class TextReporter(BaseReporter): - """Reports messages and layouts in plain text""" + """Reports messages and layouts in plain text.""" __implements__ = IReporter name = "text" @@ -185,7 +185,7 @@ class TextReporter(BaseReporter): self._modules: Set[str] = set() self._template = self.line_format self._fixed_template = self.line_format - """The output format template with any unrecognized arguments removed""" + """The output format template with any unrecognized arguments removed.""" def on_set_current_module(self, module: str, filepath: Optional[str]) -> None: """Set the format template to be used and check for unrecognized arguments.""" @@ -210,7 +210,7 @@ class TextReporter(BaseReporter): self._fixed_template = template def write_message(self, msg: Message) -> None: - """Convenience method to write a formatted message with class default template""" + """Convenience method to write a formatted message with class default template.""" self_dict = msg._asdict() for key in ("end_line", "end_column"): self_dict[key] = self_dict[key] or "" @@ -218,7 +218,7 @@ class TextReporter(BaseReporter): self.writeln(self._fixed_template.format(**self_dict)) def handle_message(self, msg: Message) -> None: - """manage message of different type and in the context of path""" + """Manage message of different type and in the context of path.""" if msg.module not in self._modules: if msg.module: self.writeln(f"************* Module {msg.module}") @@ -228,13 +228,13 @@ class TextReporter(BaseReporter): self.write_message(msg) def _display(self, layout: "Section") -> None: - """launch layouts display""" + """Launch layouts display.""" print(file=self.out) TextWriter().format(layout, self.out) class ParseableTextReporter(TextReporter): - """a reporter very similar to TextReporter, but display messages in a form + """A reporter very similar to TextReporter, but display messages in a form recognized by most text editors : <filename>:<linenum>:<msg> @@ -252,14 +252,14 @@ class ParseableTextReporter(TextReporter): class VSTextReporter(ParseableTextReporter): - """Visual studio text reporter""" + """Visual studio text reporter.""" name = "msvs" line_format = "{path}({line}): [{msg_id}({symbol}){obj}] {msg}" class ColorizedTextReporter(TextReporter): - """Simple TextReporter that colorizes text output""" + """Simple TextReporter that colorizes text output.""" name = "colorized" COLOR_MAPPING: ColorMappingDict = { @@ -324,11 +324,11 @@ class ColorizedTextReporter(TextReporter): self.out = colorama.AnsiToWin32(self.out) def _get_decoration(self, msg_id: str) -> MessageStyle: - """Returns the message style as defined in self.color_mapping""" + """Returns the message style as defined in self.color_mapping.""" return self.color_mapping.get(msg_id[0]) or MessageStyle(None) def handle_message(self, msg: Message) -> None: - """manage message of different types, and colorize output + """Manage message of different types, and colorize output using ansi escape codes """ if msg.module not in self._modules: diff --git a/pylint/reporters/ureports/base_writer.py b/pylint/reporters/ureports/base_writer.py index e87acd7ea..dba57c86f 100644 --- a/pylint/reporters/ureports/base_writer.py +++ b/pylint/reporters/ureports/base_writer.py @@ -30,10 +30,10 @@ if TYPE_CHECKING: class BaseWriter: - """base class for ureport writers""" + """Base class for ureport writers.""" def format(self, layout, stream: TextIO = sys.stdout, encoding=None) -> None: - """format and write the given layout into the stream object + """Format and write the given layout into the stream object. unicode policy: unicode strings may be found in the layout; try to call 'stream.write' with it, but give it back encoded using @@ -50,29 +50,29 @@ class BaseWriter: def format_children( self, layout: Union["EvaluationSection", "Paragraph", "Section"] ) -> None: - """recurse on the layout children and call their accept method + """Recurse on the layout children and call their accept method (see the Visitor pattern) """ for child in getattr(layout, "children", ()): child.accept(self) def writeln(self, string: str = "") -> None: - """write a line in the output buffer""" + """Write a line in the output buffer.""" self.write(string + "\n") def write(self, string: str) -> None: - """write a string in the output buffer""" + """Write a string in the output buffer.""" self.out.write(string) def begin_format(self) -> None: - """begin to format a layout""" + """Begin to format a layout.""" self.section = 0 def end_format(self) -> None: - """Finished formatting a layout""" + """Finished formatting a layout.""" def get_table_content(self, table: "Table") -> List[List[str]]: - """trick to get table content without actually writing it + """Trick to get table content without actually writing it. return an aligned list of lists containing table cells values as string """ @@ -89,7 +89,7 @@ class BaseWriter: return result def compute_content(self, layout) -> Iterator[str]: - """trick to compute the formatting of children layout before actually + """Trick to compute the formatting of children layout before actually writing it return an iterator on strings (one for each child element) diff --git a/pylint/reporters/ureports/nodes.py b/pylint/reporters/ureports/nodes.py index 280f97528..a4e32f81e 100644 --- a/pylint/reporters/ureports/nodes.py +++ b/pylint/reporters/ureports/nodes.py @@ -39,7 +39,7 @@ class VNode: class BaseLayout(VNode): - """base container node + """Base container node. attributes * children : components in this table (i.e. the table's cells) @@ -54,25 +54,25 @@ class BaseLayout(VNode): self.add_text(child) def append(self, child: VNode) -> None: - """add a node to children""" + """Add a node to children.""" assert child not in self.parents() self.children.append(child) child.parent = self def insert(self, index: int, child: VNode) -> None: - """insert a child node""" + """Insert a child node.""" self.children.insert(index, child) child.parent = self def parents(self) -> List["BaseLayout"]: - """return the ancestor nodes""" + """Return the ancestor nodes.""" assert self.parent is not self if self.parent is None: return [] return [self.parent] + self.parent.parents() def add_text(self, text: str) -> None: - """shortcut to add text data""" + """Shortcut to add text data.""" self.children.append(Text(text)) @@ -80,7 +80,7 @@ class BaseLayout(VNode): class Text(VNode): - """a text portion + """A text portion. attributes : * data : the text value as an encoded or unicode string @@ -93,7 +93,7 @@ class Text(VNode): class VerbatimText(Text): - """a verbatim text, display the raw data + """A verbatim text, display the raw data. attributes : * data : the text value as an encoded or unicode string @@ -104,7 +104,7 @@ class VerbatimText(Text): class Section(BaseLayout): - """a section + """A section. attributes : * BaseLayout attributes @@ -143,7 +143,7 @@ class EvaluationSection(Section): class Title(BaseLayout): - """a title + """A title. attributes : * BaseLayout attributes @@ -153,7 +153,7 @@ class Title(BaseLayout): class Paragraph(BaseLayout): - """a simple text paragraph + """A simple text paragraph. attributes : * BaseLayout attributes @@ -163,7 +163,7 @@ class Paragraph(BaseLayout): class Table(BaseLayout): - """some tabular data + """Some tabular data. attributes : * BaseLayout attributes diff --git a/pylint/reporters/ureports/text_writer.py b/pylint/reporters/ureports/text_writer.py index 392c86cc8..cb80e6771 100644 --- a/pylint/reporters/ureports/text_writer.py +++ b/pylint/reporters/ureports/text_writer.py @@ -10,7 +10,7 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -"""Text formatting drivers for ureports""" +"""Text formatting drivers for ureports.""" from typing import TYPE_CHECKING, List @@ -32,7 +32,7 @@ BULLETS = ["*", "-"] class TextWriter(BaseWriter): - """format layouts as text + """Format layouts as text (ReStructured inspiration but not totally handled yet) """ @@ -41,7 +41,7 @@ class TextWriter(BaseWriter): self.list_level = 0 def visit_section(self, layout: "Section") -> None: - """display a section as text""" + """Display a section as text.""" self.section += 1 self.writeln() self.format_children(layout) @@ -64,12 +64,12 @@ class TextWriter(BaseWriter): print("FIXME TITLE TOO DEEP. TURNING TITLE INTO TEXT") def visit_paragraph(self, layout: "Paragraph") -> None: - """enter a paragraph""" + """Enter a paragraph.""" self.format_children(layout) self.writeln() def visit_table(self, layout: "Table") -> None: - """display a table as text""" + """Display a table as text.""" table_content = self.get_table_content(layout) # get columns width cols_width = [0] * len(table_content[0]) @@ -82,7 +82,7 @@ class TextWriter(BaseWriter): def default_table( self, layout: "Table", table_content: List[List[str]], cols_width: List[int] ) -> None: - """format a table""" + """Format a table.""" cols_width = [size + 1 for size in cols_width] format_strings = " ".join(["%%-%ss"] * len(cols_width)) format_strings %= tuple(cols_width) @@ -103,12 +103,12 @@ class TextWriter(BaseWriter): self.write(table_linesep) def visit_verbatimtext(self, layout: "VerbatimText") -> None: - """display a verbatim layout as text (so difficult ;)""" + """Display a verbatim layout as text (so difficult ;).""" self.writeln("::\n") for line in layout.data.splitlines(): self.writeln(" " + line) self.writeln() def visit_text(self, layout: "Text") -> None: - """add some text""" + """Add some text.""" self.write(f"{layout.data}") |