fname stringlengths 63 176 | rel_fname stringclasses 706
values | line int64 -1 4.5k | name stringlengths 1 81 | kind stringclasses 2
values | category stringclasses 2
values | info stringlengths 0 77.9k ⌀ |
|---|---|---|---|---|---|---|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/json_reporter.py | pylint/reporters/json_reporter.py | 51 | dumps | ref | function | print(json.dumps(json_dumpable, indent=4), file=self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/json_reporter.py | pylint/reporters/json_reporter.py | 53 | display_reports | def | function | def display_reports(self, layout: "Section") -> None:
"""Don't do anything in this reporter."""
def _display(self, layout: "Section") -> None:
"""Do nothing."""
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/json_reporter.py | pylint/reporters/json_reporter.py | 56 | _display | def | function | def _display(self, layout: "Section") -> None:
"""Do nothing."""
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/json_reporter.py | pylint/reporters/json_reporter.py | 60 | register | def | function | def register(linter: "PyLinter") -> None:
linter.register_reporter(JSONReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/json_reporter.py | pylint/reporters/json_reporter.py | 61 | register_reporter | ref | function | linter.register_reporter(JSONReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 19 | MultiReporter | def | class | __init__ out out __del__ path_strip_prefix linter linter handle_message writeln display_reports display_messages on_set_current_module on_close |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 46 | out | def | function | def out(self):
return self.__out
@out.setter
def out(self, output: Optional[AnyFile] = None):
"""MultiReporter doesn't have its own output. This method is only
provided for API parity with BaseReporter and should not be called
with non-None values for 'output'.
"""
self.__out = None
if output is not None:
raise NotImplementedError("MultiReporter does not support direct output.")
def __del__(self) -> None:
self.close_output_files()
@property
def path_strip_prefix(self) -> str:
return self._path_strip_prefix
@property
def linter(self) -> Optional[PyLinter]:
return self._linter
@linter.setter
def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 50 | out | def | function | def out(self, output: Optional[AnyFile] = None):
"""MultiReporter doesn't have its own output. This method is only
provided for API parity with BaseReporter and should not be called
with non-None values for 'output'.
"""
self.__out = None
if output is not None:
raise NotImplementedError("MultiReporter does not support direct output.")
def __del__(self) -> None:
self.close_output_files()
@property
def path_strip_prefix(self) -> str:
return self._path_strip_prefix
@property
def linter(self) -> Optional[PyLinter]:
return self._linter
@linter.setter
def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 59 | __del__ | def | function | def __del__(self) -> None:
self.close_output_files()
@property
def path_strip_prefix(self) -> str:
return self._path_strip_prefix
@property
def linter(self) -> Optional[PyLinter]:
return self._linter
@linter.setter
def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 60 | close_output_files | ref | function | self.close_output_files()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 63 | path_strip_prefix | def | function | def path_strip_prefix(self) -> str:
return self._path_strip_prefix
@property
def linter(self) -> Optional[PyLinter]:
return self._linter
@linter.setter
def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 67 | linter | def | function | def linter(self) -> Optional[PyLinter]:
return self._linter
@linter.setter
def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 71 | linter | def | function | def linter(self, value: PyLinter) -> None:
self._linter = value
for rep in self._sub_reporters:
rep.linter = value
def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 76 | handle_message | def | function | def handle_message(self, msg: Message) -> None:
"""Handle a new message triggered on the current file."""
for rep in self._sub_reporters:
rep.handle_message(msg)
def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 79 | handle_message | ref | function | rep.handle_message(msg)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 81 | writeln | def | function | def writeln(self, string: str = "") -> None:
"""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."""
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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 84 | writeln | ref | function | rep.writeln(string)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 86 | display_reports | def | function | def display_reports(self, layout: "Section") -> None:
"""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."""
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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 89 | display_reports | ref | function | rep.display_reports(layout)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 91 | display_messages | def | function | def display_messages(self, layout: Optional["Section"]) -> None:
"""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."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 94 | display_messages | ref | function | rep.display_messages(layout)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 96 | on_set_current_module | def | function | def on_set_current_module(self, module: str, filepath: Optional[str]) -> None:
"""Hook called when a module starts to be analysed."""
for rep in self._sub_reporters:
rep.on_set_current_module(module, filepath)
def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 99 | on_set_current_module | ref | function | rep.on_set_current_module(module, filepath)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 101 | on_close | def | function | def on_close(
self,
stats: LinterStats,
previous_stats: LinterStats,
) -> None:
"""Hook called when a module finished analyzing."""
for rep in self._sub_reporters:
rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/multi_reporter.py | pylint/reporters/multi_reporter.py | 108 | on_close | ref | function | rep.on_close(stats, previous_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 26 | ReportsHandlerMixIn | def | class | __init__ report_order register_report enable_report disable_report report_is_enabled make_reports |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 35 | report_order | def | function | def report_order(self) -> MutableSequence["BaseChecker"]:
"""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.
:param reportid: The unique identifier for the report
:param r_title: The report's title
:param r_cb: The method to call to make the report
:param checker: The checker defining the report
"""
reportid = reportid.upper()
self._reports[checker].append((reportid, r_title, r_cb))
def enable_report(self, reportid: str) -> None:
"""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."""
reportid = reportid.upper()
self._reports_state[reportid] = _False
def report_is_enabled(self, reportid: str) -> bool:
"""Is the report associated to the given identifier enabled ?"""
return self._reports_state.get(reportid, _True)
def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 39 | register_report | def | function | def register_report(
self, reportid: str, r_title: str, r_cb: Callable, checker: "BaseChecker"
) -> None:
"""Register a report.
:param reportid: The unique identifier for the report
:param r_title: The report's title
:param r_cb: The method to call to make the report
:param checker: The checker defining the report
"""
reportid = reportid.upper()
self._reports[checker].append((reportid, r_title, r_cb))
def enable_report(self, reportid: str) -> None:
"""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."""
reportid = reportid.upper()
self._reports_state[reportid] = _False
def report_is_enabled(self, reportid: str) -> bool:
"""Is the report associated to the given identifier enabled ?"""
return self._reports_state.get(reportid, _True)
def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 52 | enable_report | def | function | def enable_report(self, reportid: str) -> None:
"""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."""
reportid = reportid.upper()
self._reports_state[reportid] = _False
def report_is_enabled(self, reportid: str) -> bool:
"""Is the report associated to the given identifier enabled ?"""
return self._reports_state.get(reportid, _True)
def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 57 | disable_report | def | function | def disable_report(self, reportid: str) -> None:
"""Disable the report of the given id."""
reportid = reportid.upper()
self._reports_state[reportid] = _False
def report_is_enabled(self, reportid: str) -> bool:
"""Is the report associated to the given identifier enabled ?"""
return self._reports_state.get(reportid, _True)
def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 62 | report_is_enabled | def | function | def report_is_enabled(self, reportid: str) -> bool:
"""Is the report associated to the given identifier enabled ?"""
return self._reports_state.get(reportid, _True)
def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 66 | make_reports | def | function | def make_reports( # type: ignore[misc] # ReportsHandlerMixIn is always mixed with PyLinter
self: "PyLinter",
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
"""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]:
if not self.report_is_enabled(reportid):
continue
report_sect = Section(r_title)
try:
r_cb(report_sect, stats, old_stats)
except EmptyReportError:
continue
report_sect.report_id = reportid
sect.append(report_sect)
return sect
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 72 | Section | ref | function | sect = Section("Report", f"{self.stats.statement} statements analysed.")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 73 | report_order | ref | function | for checker in self.report_order():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 75 | report_is_enabled | ref | function | if not self.report_is_enabled(reportid):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 77 | Section | ref | function | report_sect = Section(r_title)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/reports_handler_mix_in.py | pylint/reporters/reports_handler_mix_in.py | 79 | r_cb | ref | function | r_cb(report_sect, stats, old_stats)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 54 | MessageStyle | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 94 | _get_ansi_code | def | function | def _get_ansi_code(msg_style: MessageStyle) -> str:
"""Return ansi escape code corresponding to color and style.
:param msg_style: the message style
:raise KeyError: if an unexistent color or style identifier is given
:return: the built escape code
"""
ansi_code = [ANSI_STYLES[effect] for effect in msg_style.style]
if msg_style.color:
if msg_style.color.isdigit():
ansi_code.extend(["38", "5"])
ansi_code.append(msg_style.color)
else:
ansi_code.append(ANSI_COLORS[msg_style.color])
if ansi_code:
return ANSI_PREFIX + ";".join(ansi_code) + ANSI_END
return ""
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 116 | colorize_ansi | def | function | def colorize_ansi(
msg: str,
msg_style: Optional[MessageStyle] = None,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 124 | colorize_ansi | def | function | def colorize_ansi(
msg: str,
msg_style: Optional[MessageStyle] = None,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 135 | colorize_ansi | def | function | def colorize_ansi(
msg: str,
msg_style: Optional[MessageStyle] = None,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 162 | _splitstrip | ref | function | style_attrs = tuple(_splitstrip(style))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 163 | MessageStyle | ref | function | msg_style = MessageStyle(color or msg_style, style_attrs)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 167 | _get_ansi_code | ref | function | escape_code = _get_ansi_code(msg_style)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 174 | TextReporter | def | class | __init__ on_set_current_module write_message handle_message _display |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 189 | on_set_current_module | def | function | def on_set_current_module(self, module: str, filepath: Optional[str]) -> None:
"""Set the format template to be used and check for unrecognized arguments."""
template = str(self.linter.config.msg_template or self._template)
# Return early if the template is the same as the previous one
if template == self._template:
return
# Set template to the currently selected template
self._template = template
# Check to see if all parameters in the template are attributes of the Message
arguments = re.findall(r"\{(.+?)(:.*)?\}", template)
for argument in arguments:
if argument[0] not in Message._fields:
warnings.warn(
f"Don't recognize the argument '{argument[0]}' in the --msg-template. "
"Are you sure it is supported on the current version of pylint?"
)
template = re.sub(r"\{" + argument[0] + r"(:.*?)?\}", "", template)
self._fixed_template = template
def write_message(self, msg: Message) -> None:
"""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 ""
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."""
if msg.module not in self._modules:
if msg.module:
self.writeln(f"************* Module {msg.module}")
self._modules.add(msg.module)
else:
self.writeln("************* ")
self.write_message(msg)
def _display(self, layout: "Section") -> None:
"""Launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 201 | findall | ref | function | arguments = re.findall(r"\{(.+?)(:.*)?\}", template)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 208 | sub | ref | function | template = re.sub(r"\{" + argument[0] + r"(:.*?)?\}", "", template)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 211 | write_message | def | function | def write_message(self, msg: Message) -> None:
"""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 ""
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."""
if msg.module not in self._modules:
if msg.module:
self.writeln(f"************* Module {msg.module}")
self._modules.add(msg.module)
else:
self.writeln("************* ")
self.write_message(msg)
def _display(self, layout: "Section") -> None:
"""Launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 213 | _asdict | ref | function | self_dict = msg._asdict()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 217 | writeln | ref | function | self.writeln(self._fixed_template.format(**self_dict))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 219 | handle_message | def | function | def handle_message(self, msg: Message) -> None:
"""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}")
self._modules.add(msg.module)
else:
self.writeln("************* ")
self.write_message(msg)
def _display(self, layout: "Section") -> None:
"""Launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 223 | writeln | ref | function | self.writeln(f"************* Module {msg.module}")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 226 | writeln | ref | function | self.writeln("************* ")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 227 | write_message | ref | function | self.write_message(msg)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 229 | _display | def | function | def _display(self, layout: "Section") -> None:
"""Launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 232 | TextWriter | ref | function | TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 235 | ParseableTextReporter | def | class | __init__ |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 253 | VSTextReporter | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 260 | ColorizedTextReporter | def | class | __init__ __init__ __init__ _get_decoration handle_message |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 265 | MessageStyle | ref | function | "I": MessageStyle("green"),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 266 | MessageStyle | ref | function | "C": MessageStyle(None, ("bold",)),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 267 | MessageStyle | ref | function | "R": MessageStyle("magenta", ("bold", "italic")),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 268 | MessageStyle | ref | function | "W": MessageStyle("magenta"),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 269 | MessageStyle | ref | function | "E": MessageStyle("red", ("bold",)),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 270 | MessageStyle | ref | function | "F": MessageStyle("red", ("bold", "underline")),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 271 | MessageStyle | ref | function | "S": MessageStyle("yellow", ("inverse",)), # S stands for module Separator
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 311 | _splitstrip | ref | function | style_attrs = tuple(_splitstrip(value[1]))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 312 | MessageStyle | ref | function | temp_color_mapping[key] = MessageStyle(color, style_attrs)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 323 | AnsiToWin32 | ref | function | self.out = colorama.AnsiToWin32(self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 325 | _get_decoration | def | function | def _get_decoration(self, msg_id: str) -> MessageStyle:
"""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
using ansi escape codes
"""
if msg.module not in self._modules:
msg_style = self._get_decoration("S")
if msg.module:
modsep = colorize_ansi(f"************* Module {msg.module}", msg_style)
else:
modsep = colorize_ansi(f"************* {msg.module}", msg_style)
self.writeln(modsep)
self._modules.add(msg.module)
msg_style = self._get_decoration(msg.C)
msg = msg._replace(
**{
attr: colorize_ansi(getattr(msg, attr), msg_style)
for attr in ("msg", "symbol", "category", "C")
}
)
self.write_message(msg)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 327 | MessageStyle | ref | function | return self.color_mapping.get(msg_id[0]) or MessageStyle(None)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 329 | handle_message | def | function | def handle_message(self, msg: Message) -> None:
"""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}")
self._modules.add(msg.module)
else:
self.writeln("************* ")
self.write_message(msg)
def _display(self, layout: "Section") -> None:
"""Launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 334 | _get_decoration | ref | function | msg_style = self._get_decoration("S")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 336 | colorize_ansi | ref | function | modsep = colorize_ansi(f"************* Module {msg.module}", msg_style)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 338 | colorize_ansi | ref | function | modsep = colorize_ansi(f"************* {msg.module}", msg_style)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 339 | writeln | ref | function | self.writeln(modsep)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 341 | _get_decoration | ref | function | msg_style = self._get_decoration(msg.C)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 343 | _replace | ref | function | msg = msg._replace(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 345 | colorize_ansi | ref | function | attr: colorize_ansi(getattr(msg, attr), msg_style)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 349 | write_message | ref | function | self.write_message(msg)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 352 | register | def | function | def register(linter: "PyLinter") -> None:
linter.register_reporter(TextReporter)
linter.register_reporter(ParseableTextReporter)
linter.register_reporter(VSTextReporter)
linter.register_reporter(ColorizedTextReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 353 | register_reporter | ref | function | linter.register_reporter(TextReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 354 | register_reporter | ref | function | linter.register_reporter(ParseableTextReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 355 | register_reporter | ref | function | linter.register_reporter(VSTextReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/text.py | pylint/reporters/text.py | 356 | register_reporter | ref | function | linter.register_reporter(ColorizedTextReporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 31 | BaseWriter | def | class | format format_children writeln write begin_format end_format get_table_content compute_content |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 45 | begin_format | ref | function | self.begin_format()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 46 | accept | ref | function | layout.accept(self)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 47 | end_format | ref | function | self.end_format()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 49 | format_children | def | function | def format_children(
self, layout: Union["EvaluationSection", "Paragraph", "Section"]
) -> None:
"""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."""
self.write(string + "\n")
def write(self, string: str) -> None:
"""Write a string in the output buffer."""
self.out.write(string)
def begin_format(self) -> None:
"""Begin to format a layout."""
self.section = 0
def end_format(self) -> None:
"""Finished formatting a layout."""
def get_table_content(self, table: "Table") -> List[List[str]]:
"""Trick to get table content without actually writing it.
return an aligned list of lists containing table cells values as string
"""
result: List[List[str]] = [[]]
cols = table.cols
for cell in self.compute_content(table):
if cols == 0:
result.append([])
cols = table.cols
cols -= 1
result[-1].append(cell)
# fill missing cells
result[-1] += [""] * (cols - len(result[-1]))
return result
def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 56 | accept | ref | function | child.accept(self)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 58 | writeln | def | function | def writeln(self, string: str = "") -> None:
"""Write a line in the output buffer."""
self.write(string + "\n")
def write(self, string: str) -> None:
"""Write a string in the output buffer."""
self.out.write(string)
def begin_format(self) -> None:
"""Begin to format a layout."""
self.section = 0
def end_format(self) -> None:
"""Finished formatting a layout."""
def get_table_content(self, table: "Table") -> List[List[str]]:
"""Trick to get table content without actually writing it.
return an aligned list of lists containing table cells values as string
"""
result: List[List[str]] = [[]]
cols = table.cols
for cell in self.compute_content(table):
if cols == 0:
result.append([])
cols = table.cols
cols -= 1
result[-1].append(cell)
# fill missing cells
result[-1] += [""] * (cols - len(result[-1]))
return result
def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 66 | begin_format | def | function | def begin_format(self) -> None:
"""Begin to format a layout."""
self.section = 0
def end_format(self) -> None:
"""Finished formatting a layout."""
def get_table_content(self, table: "Table") -> List[List[str]]:
"""Trick to get table content without actually writing it.
return an aligned list of lists containing table cells values as string
"""
result: List[List[str]] = [[]]
cols = table.cols
for cell in self.compute_content(table):
if cols == 0:
result.append([])
cols = table.cols
cols -= 1
result[-1].append(cell)
# fill missing cells
result[-1] += [""] * (cols - len(result[-1]))
return result
def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 70 | end_format | def | function | def end_format(self) -> None:
"""Finished formatting a layout."""
def get_table_content(self, table: "Table") -> List[List[str]]:
"""Trick to get table content without actually writing it.
return an aligned list of lists containing table cells values as string
"""
result: List[List[str]] = [[]]
cols = table.cols
for cell in self.compute_content(table):
if cols == 0:
result.append([])
cols = table.cols
cols -= 1
result[-1].append(cell)
# fill missing cells
result[-1] += [""] * (cols - len(result[-1]))
return result
def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 73 | get_table_content | def | function | def get_table_content(self, table: "Table") -> List[List[str]]:
"""Trick to get table content without actually writing it.
return an aligned list of lists containing table cells values as string
"""
result: List[List[str]] = [[]]
cols = table.cols
for cell in self.compute_content(table):
if cols == 0:
result.append([])
cols = table.cols
cols -= 1
result[-1].append(cell)
# fill missing cells
result[-1] += [""] * (cols - len(result[-1]))
return result
def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 80 | compute_content | ref | function | for cell in self.compute_content(table):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 90 | compute_content | def | function | def compute_content(self, layout) -> Iterator[str]:
"""Trick to compute the formatting of children layout before actually
writing it
return an iterator on strings (one for each child element)
"""
# Patch the underlying output stream with a fresh-generated stream,
# which is used to store a temporary representation of a child
# node.
out = self.out
try:
for child in layout.children:
stream = StringIO()
self.out = stream
child.accept(self)
yield stream.getvalue()
finally:
self.out = out
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/reporters/ureports/base_writer.py | pylint/reporters/ureports/base_writer.py | 104 | accept | ref | function | child.accept(self)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.