Skip to content
Snippets Groups Projects
Commit 70618da9 authored by DEBREUVE Eric's avatar DEBREUVE Eric
Browse files

added PopIssues and n_staged_issues, better type formatting, api re-organization

parent 64f6fdf8
Branches main
No related tags found
No related merge requests found
Showing
with 127 additions and 19 deletions
......@@ -12,9 +12,12 @@ else:
import site
from pathlib import Path as path_t
paths = site.getsitepackages() + [site.getusersitepackages()]
folder = path_t(__file__).parent
if folder not in paths:
paths = site.getsitepackages() + [site.getusersitepackages()]
for path in paths:
if folder.is_relative_to(path):
break
else:
beartype_this_package()
from logger_36.instance.logger import L
......
File moved
......@@ -4,7 +4,10 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
SEE COPYRIGHT NOTICE BELOW
"""
from logger_36.task.storage import SaveLOGasHTML # noqa
from logger_36.extension.exception import ( # noqa
OverrideExceptionFormat,
ResetExceptionFormat,
)
"""
COPYRIGHT NOTICE
......
File moved
"""
Copyright CNRS/Inria/UniCA
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
SEE COPYRIGHT NOTICE BELOW
"""
from logger_36.task.handling import ( # noqa
AddConsoleHandler,
AddFileHandler,
AddGenericHandler,
AddRichConsoleHandler,
)
"""
COPYRIGHT NOTICE
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
This software is being developed by Eric Debreuve, a CNRS employee and
member of team Morpheme.
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
I3S, and Laboratory iBV.
CNRS: https://www.cnrs.fr/index.php/en
Inria: https://www.inria.fr/en/
UniCA: https://univ-cotedazur.eu/
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
I3S: https://www.i3s.unice.fr/en/
iBV: http://ibv.unice.fr/
Team Morpheme: https://team.inria.fr/morpheme/
"""
File moved
......@@ -5,6 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
"""
from logger_36.extension.html_ import html_content_t # noqa
from logger_36.task.storage import SaveLOGasHTML # noqa
"""
COPYRIGHT NOTICE
......
File moved
File moved
......@@ -5,6 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
"""
from logger_36.type.logger import logger_t # noqa
from logger_36.type.loggers import loggers_t # noqa
"""
COPYRIGHT NOTICE
......
......@@ -39,7 +39,12 @@ def MessageWithActualExpected(
else:
dot = ""
return f"{message}: Actual={actual}:{type(actual).__name__}; {expected}{dot}"
if isinstance(actual, type):
actual = actual.__name__
else:
actual = f"{actual}:{type(actual).__name__}"
return f"{message}: Actual={actual}; {expected}{dot}"
def _FormattedExpected(
......@@ -54,14 +59,17 @@ def _FormattedExpected(
else:
expected = ", ".join(map(str, expected))
return f"Valid values: {expected}"
if isinstance(expected, type):
return f"Expected{operator}{expected.__name__}"
if operator == "=":
stripe = f":{type(expected).__name__}"
else:
if operator == "=":
stripe = f":{type(expected).__name__}"
else:
stripe = ""
if operator == ":":
operator = ": "
return f"Expected{operator}{expected}{stripe}"
stripe = ""
if operator == ":":
operator = ": "
return f"Expected{operator}{expected}{stripe}"
"""
......
File moved
......@@ -40,10 +40,14 @@ from logger_36.constant.record import (
SHOW_W_RULE_ATTR,
STORE_MEMORY_ATTR,
)
from logger_36.exception import OverrideExceptionFormat
from logger_36.handler import AddConsoleHandler, AddFileHandler, AddRichConsoleHandler
from logger_36.extension.exception import OverrideExceptionFormat
from logger_36.task.format.message import MessageWithActualExpected
from logger_36.task.format.rule import RuleAsText
from logger_36.task.handling import (
AddConsoleHandler,
AddFileHandler,
AddRichConsoleHandler,
)
from logger_36.task.measure.chronos import ElapsedTime
from logger_36.task.measure.memory import CurrentUsage as CurrentMemoryUsage
from logger_36.type.issue import NewIssue, issue_t
......@@ -111,6 +115,11 @@ class logger_t(base_t):
""""""
return self.staged_issues.__len__() > 0
@property
def n_staged_issues(self) -> int:
""""""
return self.staged_issues.__len__()
@property
def past_logs_as_HTML(self) -> str | None:
"""
......@@ -497,6 +506,27 @@ class logger_t(base_t):
)
self.staged_issues.append(issue)
def PopIssues(self, /, *, should_remove_context: bool = False) -> list[str]:
""""""
if not self.has_staged_issues:
return []
output = []
if should_remove_context:
separator = ISSUE_CONTEXT_END
else:
separator = ISSUE_LEVEL_SEPARATOR
separator_length = separator.__len__()
for issue in self.staged_issues:
start_idx = issue.find(separator)
issue = issue[(start_idx + separator_length) :]
output.append(issue)
self.staged_issues.clear()
return output
def CommitIssues(
self,
/,
......
......@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
SEE COPYRIGHT NOTICE BELOW
"""
__version__ = "2025.11"
__version__ = "2025.12"
"""
COPYRIGHT NOTICE
......
......@@ -6,7 +6,7 @@ SEE COPYRIGHT NOTICE BELOW
import random as rndm
from logger_36.exception import OverrideExceptionFormat
from logger_36.extension.exception import OverrideExceptionFormat
OverrideExceptionFormat()
......
......@@ -14,11 +14,15 @@ from pathlib import Path as path_t
from tempfile import TemporaryDirectory
from logger_36 import L
from logger_36.api.memory import LogMaximumMemoryUsage, LogMemoryUsages
from logger_36.api.storage import SaveLOGasHTML
from logger_36.api.system import LogSystemDetails
from logger_36.extension.html_ import html_content_t
from logger_36.handler import AddFileHandler, AddGenericHandler, AddRichConsoleHandler
from logger_36.memory import LogMaximumMemoryUsage, LogMemoryUsages
from logger_36.storage import SaveLOGasHTML
from logger_36.system import LogSystemDetails
from logger_36.task.handling import (
AddFileHandler,
AddGenericHandler,
AddRichConsoleHandler,
)
VERY_LONG_LINE = "V" + 30 * "e" + "ry l" + 30 * "o" + "ng line"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment