logger-36 2024.1__py3-none-any.whl → 2025.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- logger_36/__init__.py +64 -42
- logger_36/api/logger.py +53 -0
- logger_36/api/storage.py +53 -0
- logger_36/catalog/config/console_rich.py +76 -0
- logger_36/catalog/handler/console.py +117 -0
- logger_36/catalog/handler/console_rich.py +235 -0
- logger_36/catalog/handler/file.py +128 -0
- logger_36/catalog/handler/generic.py +228 -0
- logger_36/catalog/logger/chronos.py +61 -0
- logger_36/catalog/logger/gpu.py +90 -0
- logger_36/catalog/logger/memory.py +129 -0
- logger_36/catalog/logger/system.py +84 -0
- logger_36/config/issue.py +56 -0
- logger_36/config/logger.py +103 -0
- logger_36/config/memory.py +54 -0
- logger_36/config/message.py +66 -0
- logger_36/config/system.py +70 -0
- logger_36/constant/error.py +70 -0
- logger_36/constant/generic.py +58 -0
- logger_36/constant/handler.py +58 -0
- logger_36/constant/issue.py +58 -0
- logger_36/constant/logger.py +67 -0
- logger_36/constant/memory.py +58 -0
- logger_36/constant/message.py +72 -0
- logger_36/constant/record.py +55 -0
- logger_36/constant/system.py +60 -0
- logger_36/content.py +55 -0
- logger_36/exception.py +105 -0
- logger_36/gpu.py +53 -0
- logger_36/handler.py +209 -0
- logger_36/instance/logger.py +55 -0
- logger_36/instance/loggers.py +56 -0
- logger_36/memory.py +60 -0
- logger_36/storage.py +53 -0
- logger_36/system.py +53 -0
- logger_36/task/format/memory.py +132 -0
- logger_36/task/format/message.py +111 -0
- logger_36/task/format/rule.py +74 -0
- logger_36/task/inspection.py +70 -48
- logger_36/task/measure/chronos.py +84 -0
- logger_36/task/measure/memory.py +72 -0
- logger_36/task/storage.py +127 -46
- logger_36/time.py +54 -0
- logger_36/type/handler.py +184 -0
- logger_36/type/issue.py +91 -0
- logger_36/type/logger.py +542 -0
- logger_36/type/loggers.py +78 -0
- logger_36/version.py +53 -32
- logger_36-2025.3.dist-info/METADATA +154 -0
- logger_36-2025.3.dist-info/RECORD +52 -0
- {logger_36-2024.1.dist-info → logger_36-2025.3.dist-info}/WHEEL +1 -1
- logger_36/catalog/gpu.py +0 -56
- logger_36/catalog/memory.py +0 -109
- logger_36/catalog/system.py +0 -84
- logger_36/config.py +0 -48
- logger_36/constant.py +0 -52
- logger_36/instance.py +0 -34
- logger_36/main.py +0 -96
- logger_36/measure/chronos.py +0 -55
- logger_36/measure/memory.py +0 -50
- logger_36/type/console.py +0 -122
- logger_36/type/extension.py +0 -122
- logger_36/type/file.py +0 -52
- logger_36/type/generic.py +0 -115
- logger_36-2024.1.dist-info/METADATA +0 -106
- logger_36-2024.1.dist-info/RECORD +0 -21
- {logger_36-2024.1.dist-info → logger_36-2025.3.dist-info}/top_level.txt +0 -0
logger_36/task/storage.py
CHANGED
@@ -1,49 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# This software is governed by the CeCILL license under French law and
|
7
|
-
# abiding by the rules of distribution of free software. You can use,
|
8
|
-
# modify and/ or redistribute the software under the terms of the CeCILL
|
9
|
-
# license as circulated by CEA, CNRS and INRIA at the following URL
|
10
|
-
# "http://www.cecill.info".
|
11
|
-
#
|
12
|
-
# As a counterpart to the access to the source code and rights to copy,
|
13
|
-
# modify and redistribute granted by the license, users are provided only
|
14
|
-
# with a limited warranty and the software's author, the holder of the
|
15
|
-
# economic rights, and the successive licensors have only limited
|
16
|
-
# liability.
|
17
|
-
#
|
18
|
-
# In this respect, the user's attention is drawn to the risks associated
|
19
|
-
# with loading, using, modifying and/or developing or reproducing the
|
20
|
-
# software by the user in light of its specific status of free software,
|
21
|
-
# that may mean that it is complicated to manipulate, and that also
|
22
|
-
# therefore means that it is reserved for developers and experienced
|
23
|
-
# professionals having in-depth computer knowledge. Users are therefore
|
24
|
-
# encouraged to load and test the software's suitability as regards their
|
25
|
-
# requirements in conditions enabling the security of their systems and/or
|
26
|
-
# data to be ensured and, more generally, to use and operate it in the
|
27
|
-
# same conditions as regards security.
|
28
|
-
#
|
29
|
-
# The fact that you are presently reading this means that you have had
|
30
|
-
# knowledge of the CeCILL license and that you accept its terms.
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
31
6
|
|
7
|
+
import dataclasses as d
|
32
8
|
import logging as lggg
|
9
|
+
import re as regx
|
10
|
+
from html.parser import HTMLParser as html_parser_t
|
11
|
+
from io import IOBase as io_base_t
|
33
12
|
from pathlib import Path as path_t
|
34
|
-
from typing import TextIO
|
35
13
|
|
36
|
-
|
14
|
+
try:
|
15
|
+
from rich.console import Console as console_t # noqa
|
16
|
+
except ModuleNotFoundError:
|
17
|
+
console_t = None
|
37
18
|
|
38
|
-
from logger_36.instance import LOGGER
|
19
|
+
from logger_36.instance.logger import LOGGER
|
39
20
|
|
21
|
+
_BODY_END_PATTERN = r"</[bB][oO][dD][yY]>(.|\n)*$"
|
40
22
|
|
41
|
-
|
23
|
+
|
24
|
+
@d.dataclass(slots=True, repr=False, eq=False)
|
25
|
+
class html_reader_t(html_parser_t):
|
26
|
+
source: str = ""
|
27
|
+
inside_body: bool = d.field(init=False, default=False)
|
28
|
+
body_position_start: tuple[int, int] = d.field(init=False, default=(-1, -1))
|
29
|
+
body_position_end: tuple[int, int] = d.field(init=False, default=(-1, -1))
|
30
|
+
pieces: list[str] = d.field(init=False, default_factory=list)
|
31
|
+
|
32
|
+
def __post_init__(self) -> None:
|
33
|
+
""""""
|
34
|
+
html_parser_t.__init__(self)
|
35
|
+
self.source = self.source.strip()
|
36
|
+
self.feed(self.source)
|
37
|
+
|
38
|
+
def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]], /) -> None:
|
39
|
+
""""""
|
40
|
+
if tag == "body":
|
41
|
+
self.body_position_start = self.getpos()
|
42
|
+
self.inside_body = True
|
43
|
+
|
44
|
+
def handle_endtag(self, tag: str, /) -> None:
|
45
|
+
""""""
|
46
|
+
if tag == "body":
|
47
|
+
self.body_position_end = self.getpos()
|
48
|
+
self.inside_body = False
|
49
|
+
|
50
|
+
def handle_data(self, data: str, /) -> None:
|
51
|
+
""""""
|
52
|
+
if self.inside_body:
|
53
|
+
self.pieces.append(data)
|
54
|
+
|
55
|
+
@property
|
56
|
+
def body(self) -> str:
|
57
|
+
""""""
|
58
|
+
output = self.source.splitlines()
|
59
|
+
output = "\n".join(
|
60
|
+
output[self.body_position_start[0] : (self.body_position_end[0] + 1)]
|
61
|
+
)
|
62
|
+
output = output[self.body_position_start[1] :]
|
63
|
+
output = regx.sub(_BODY_END_PATTERN, "", output, count=1)
|
64
|
+
|
65
|
+
return output.strip()
|
66
|
+
|
67
|
+
@property
|
68
|
+
def body_as_text(self) -> str:
|
69
|
+
""""""
|
70
|
+
return "".join(self.pieces).strip()
|
71
|
+
|
72
|
+
|
73
|
+
def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
42
74
|
"""
|
43
75
|
From first console handler found.
|
44
76
|
"""
|
45
77
|
cannot_save = "Cannot save logging record as HTML"
|
46
78
|
|
79
|
+
if console_t is None:
|
80
|
+
LOGGER.warning(f"{cannot_save}: The Rich console cannot be imported.")
|
81
|
+
return
|
82
|
+
|
47
83
|
if path is None:
|
48
84
|
for handler in LOGGER.handlers:
|
49
85
|
if isinstance(handler, lggg.FileHandler):
|
@@ -65,19 +101,64 @@ def SaveLOGasHTML(path: str | path_t | TextIO = None) -> None:
|
|
65
101
|
LOGGER.warning(f'{cannot_save}: File "{path}" already exists.')
|
66
102
|
return
|
67
103
|
|
68
|
-
console = None
|
69
|
-
found = False
|
70
104
|
for handler in LOGGER.handlers:
|
71
105
|
console = getattr(handler, "console", None)
|
72
|
-
if
|
106
|
+
if isinstance(console, console_t) and console.record:
|
107
|
+
html = console.export_html()
|
108
|
+
if actual_file:
|
109
|
+
with open(path, "w") as accessor:
|
110
|
+
accessor.write(html)
|
111
|
+
else:
|
112
|
+
path.write(html)
|
73
113
|
break
|
74
|
-
|
75
|
-
if found:
|
76
|
-
html = console.export_html()
|
77
|
-
if actual_file:
|
78
|
-
with open(path, "w") as accessor:
|
79
|
-
accessor.write(html)
|
80
|
-
else:
|
81
|
-
path.write(html)
|
82
114
|
else:
|
83
|
-
LOGGER.warning(
|
115
|
+
LOGGER.warning(
|
116
|
+
f"{cannot_save}: No handler has a RICH console with recording ON."
|
117
|
+
)
|
118
|
+
|
119
|
+
|
120
|
+
"""
|
121
|
+
COPYRIGHT NOTICE
|
122
|
+
|
123
|
+
This software is governed by the CeCILL license under French law and
|
124
|
+
abiding by the rules of distribution of free software. You can use,
|
125
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
126
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
127
|
+
"http://www.cecill.info".
|
128
|
+
|
129
|
+
As a counterpart to the access to the source code and rights to copy,
|
130
|
+
modify and redistribute granted by the license, users are provided only
|
131
|
+
with a limited warranty and the software's author, the holder of the
|
132
|
+
economic rights, and the successive licensors have only limited
|
133
|
+
liability.
|
134
|
+
|
135
|
+
In this respect, the user's attention is drawn to the risks associated
|
136
|
+
with loading, using, modifying and/or developing or reproducing the
|
137
|
+
software by the user in light of its specific status of free software,
|
138
|
+
that may mean that it is complicated to manipulate, and that also
|
139
|
+
therefore means that it is reserved for developers and experienced
|
140
|
+
professionals having in-depth computer knowledge. Users are therefore
|
141
|
+
encouraged to load and test the software's suitability as regards their
|
142
|
+
requirements in conditions enabling the security of their systems and/or
|
143
|
+
data to be ensured and, more generally, to use and operate it in the
|
144
|
+
same conditions as regards security.
|
145
|
+
|
146
|
+
The fact that you are presently reading this means that you have had
|
147
|
+
knowledge of the CeCILL license and that you accept its terms.
|
148
|
+
|
149
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
150
|
+
|
151
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
152
|
+
member of team Morpheme.
|
153
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
154
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
155
|
+
I3S, and Laboratory iBV.
|
156
|
+
|
157
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
158
|
+
Inria: https://www.inria.fr/en/
|
159
|
+
UniCA: https://univ-cotedazur.eu/
|
160
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
161
|
+
I3S: https://www.i3s.unice.fr/en/
|
162
|
+
iBV: http://ibv.unice.fr/
|
163
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
164
|
+
"""
|
logger_36/time.py
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
from logger_36.catalog.logger.chronos import LogElapsedTime
|
8
|
+
from logger_36.task.measure.chronos import ElapsedTime, TimeStamp
|
9
|
+
|
10
|
+
"""
|
11
|
+
COPYRIGHT NOTICE
|
12
|
+
|
13
|
+
This software is governed by the CeCILL license under French law and
|
14
|
+
abiding by the rules of distribution of free software. You can use,
|
15
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
16
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
17
|
+
"http://www.cecill.info".
|
18
|
+
|
19
|
+
As a counterpart to the access to the source code and rights to copy,
|
20
|
+
modify and redistribute granted by the license, users are provided only
|
21
|
+
with a limited warranty and the software's author, the holder of the
|
22
|
+
economic rights, and the successive licensors have only limited
|
23
|
+
liability.
|
24
|
+
|
25
|
+
In this respect, the user's attention is drawn to the risks associated
|
26
|
+
with loading, using, modifying and/or developing or reproducing the
|
27
|
+
software by the user in light of its specific status of free software,
|
28
|
+
that may mean that it is complicated to manipulate, and that also
|
29
|
+
therefore means that it is reserved for developers and experienced
|
30
|
+
professionals having in-depth computer knowledge. Users are therefore
|
31
|
+
encouraged to load and test the software's suitability as regards their
|
32
|
+
requirements in conditions enabling the security of their systems and/or
|
33
|
+
data to be ensured and, more generally, to use and operate it in the
|
34
|
+
same conditions as regards security.
|
35
|
+
|
36
|
+
The fact that you are presently reading this means that you have had
|
37
|
+
knowledge of the CeCILL license and that you accept its terms.
|
38
|
+
|
39
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
40
|
+
|
41
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
42
|
+
member of team Morpheme.
|
43
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
44
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
45
|
+
I3S, and Laboratory iBV.
|
46
|
+
|
47
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
48
|
+
Inria: https://www.inria.fr/en/
|
49
|
+
UniCA: https://univ-cotedazur.eu/
|
50
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
51
|
+
I3S: https://www.i3s.unice.fr/en/
|
52
|
+
iBV: http://ibv.unice.fr/
|
53
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
54
|
+
"""
|
@@ -0,0 +1,184 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import dataclasses as d
|
8
|
+
import logging as lggg
|
9
|
+
import sys as sstm
|
10
|
+
import typing as h
|
11
|
+
|
12
|
+
from logger_36.config.message import (
|
13
|
+
LEVEL_CLOSING,
|
14
|
+
LEVEL_OPENING,
|
15
|
+
MESSAGE_MARKER,
|
16
|
+
WHERE_SEPARATOR,
|
17
|
+
)
|
18
|
+
from logger_36.constant.error import MEMORY_MEASURE_ERROR
|
19
|
+
from logger_36.constant.handler import HANDLER_CODES
|
20
|
+
from logger_36.constant.message import NEXT_LINE_PROLOGUE
|
21
|
+
from logger_36.task.format.message import MessageWithActualExpected
|
22
|
+
from logger_36.task.measure.chronos import TimeStamp
|
23
|
+
from logger_36.task.measure.memory import CanCheckUsage as CanCheckMemoryUsage
|
24
|
+
|
25
|
+
_MEMORY_MEASURE_ERROR = MEMORY_MEASURE_ERROR
|
26
|
+
|
27
|
+
|
28
|
+
@d.dataclass(slots=True, repr=False, eq=False)
|
29
|
+
class handler_extension_t:
|
30
|
+
name: str | None = None
|
31
|
+
should_store_memory_usage: bool = False
|
32
|
+
message_width: int = -1
|
33
|
+
MessageFromRecord: h.Callable[..., str] = d.field(init=False)
|
34
|
+
|
35
|
+
handler: d.InitVar[lggg.Handler | None] = None
|
36
|
+
level: d.InitVar[int] = lggg.NOTSET
|
37
|
+
formatter: d.InitVar[lggg.Formatter | None] = None
|
38
|
+
|
39
|
+
def __post_init__(
|
40
|
+
self, handler: lggg.Handler | None, level: int, formatter: lggg.Formatter | None
|
41
|
+
) -> None:
|
42
|
+
""""""
|
43
|
+
global _MEMORY_MEASURE_ERROR
|
44
|
+
|
45
|
+
if self.name in HANDLER_CODES:
|
46
|
+
raise ValueError(
|
47
|
+
MessageWithActualExpected(
|
48
|
+
"Invalid handler name",
|
49
|
+
actual=self.name,
|
50
|
+
expected=f"a name not in {str(HANDLER_CODES)[1:-1]}",
|
51
|
+
)
|
52
|
+
)
|
53
|
+
|
54
|
+
if self.name is None:
|
55
|
+
self.name = TimeStamp()
|
56
|
+
|
57
|
+
if self.should_store_memory_usage and not CanCheckMemoryUsage():
|
58
|
+
self.should_store_memory_usage = False
|
59
|
+
if _MEMORY_MEASURE_ERROR is not None:
|
60
|
+
print(_MEMORY_MEASURE_ERROR, file=sstm.stderr)
|
61
|
+
_MEMORY_MEASURE_ERROR = None
|
62
|
+
|
63
|
+
handler.setLevel(level)
|
64
|
+
|
65
|
+
if 0 < self.message_width < 5:
|
66
|
+
self.message_width = 5
|
67
|
+
if formatter is None:
|
68
|
+
self.MessageFromRecord = self._MessageFromRecord
|
69
|
+
else:
|
70
|
+
handler.setFormatter(formatter)
|
71
|
+
self.MessageFromRecord = handler.formatter.format
|
72
|
+
|
73
|
+
def _MessageFromRecord(
|
74
|
+
self,
|
75
|
+
record: lggg.LogRecord,
|
76
|
+
/,
|
77
|
+
*,
|
78
|
+
PreProcessed: h.Callable[[str], str] | None = None,
|
79
|
+
) -> str:
|
80
|
+
"""
|
81
|
+
See logger_36.catalog.handler.README.txt.
|
82
|
+
"""
|
83
|
+
message = record.msg
|
84
|
+
|
85
|
+
if PreProcessed is not None:
|
86
|
+
message = PreProcessed(message)
|
87
|
+
if (self.message_width <= 0) or (message.__len__() <= self.message_width):
|
88
|
+
if "\n" in message:
|
89
|
+
message = NEXT_LINE_PROLOGUE.join(message.splitlines())
|
90
|
+
else:
|
91
|
+
if "\n" in message:
|
92
|
+
lines = _WrappedLines(message.splitlines(), self.message_width)
|
93
|
+
else:
|
94
|
+
lines = _WrappedLines([message], self.message_width)
|
95
|
+
message = NEXT_LINE_PROLOGUE.join(lines)
|
96
|
+
|
97
|
+
if (where := getattr(record, "where", None)) is None:
|
98
|
+
where = ""
|
99
|
+
else:
|
100
|
+
where = f"{NEXT_LINE_PROLOGUE}{WHERE_SEPARATOR} {where}"
|
101
|
+
|
102
|
+
return (
|
103
|
+
f"{record.when_or_elapsed}"
|
104
|
+
f"{LEVEL_OPENING}{record.level_first_letter}{LEVEL_CLOSING} "
|
105
|
+
f"{MESSAGE_MARKER} {message}{where}"
|
106
|
+
)
|
107
|
+
|
108
|
+
|
109
|
+
def _WrappedLines(lines: list[str], message_width: int, /) -> list[str]:
|
110
|
+
""""""
|
111
|
+
output = []
|
112
|
+
|
113
|
+
for line in lines:
|
114
|
+
while line.__len__() > message_width:
|
115
|
+
if all(
|
116
|
+
_elm != " " for _elm in line[(message_width - 1) : (message_width + 1)]
|
117
|
+
):
|
118
|
+
if line[message_width - 2] == " ":
|
119
|
+
piece, line = (
|
120
|
+
line[: (message_width - 2)].rstrip(),
|
121
|
+
line[(message_width - 1) :],
|
122
|
+
)
|
123
|
+
else:
|
124
|
+
piece, line = (
|
125
|
+
line[: (message_width - 1)] + "-",
|
126
|
+
line[(message_width - 1) :],
|
127
|
+
)
|
128
|
+
else:
|
129
|
+
piece, line = (
|
130
|
+
line[:message_width].rstrip(),
|
131
|
+
line[message_width:].lstrip(),
|
132
|
+
)
|
133
|
+
output.append(piece)
|
134
|
+
|
135
|
+
output.append(line)
|
136
|
+
|
137
|
+
return output
|
138
|
+
|
139
|
+
|
140
|
+
"""
|
141
|
+
COPYRIGHT NOTICE
|
142
|
+
|
143
|
+
This software is governed by the CeCILL license under French law and
|
144
|
+
abiding by the rules of distribution of free software. You can use,
|
145
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
146
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
147
|
+
"http://www.cecill.info".
|
148
|
+
|
149
|
+
As a counterpart to the access to the source code and rights to copy,
|
150
|
+
modify and redistribute granted by the license, users are provided only
|
151
|
+
with a limited warranty and the software's author, the holder of the
|
152
|
+
economic rights, and the successive licensors have only limited
|
153
|
+
liability.
|
154
|
+
|
155
|
+
In this respect, the user's attention is drawn to the risks associated
|
156
|
+
with loading, using, modifying and/or developing or reproducing the
|
157
|
+
software by the user in light of its specific status of free software,
|
158
|
+
that may mean that it is complicated to manipulate, and that also
|
159
|
+
therefore means that it is reserved for developers and experienced
|
160
|
+
professionals having in-depth computer knowledge. Users are therefore
|
161
|
+
encouraged to load and test the software's suitability as regards their
|
162
|
+
requirements in conditions enabling the security of their systems and/or
|
163
|
+
data to be ensured and, more generally, to use and operate it in the
|
164
|
+
same conditions as regards security.
|
165
|
+
|
166
|
+
The fact that you are presently reading this means that you have had
|
167
|
+
knowledge of the CeCILL license and that you accept its terms.
|
168
|
+
|
169
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
170
|
+
|
171
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
172
|
+
member of team Morpheme.
|
173
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
174
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
175
|
+
I3S, and Laboratory iBV.
|
176
|
+
|
177
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
178
|
+
Inria: https://www.inria.fr/en/
|
179
|
+
UniCA: https://univ-cotedazur.eu/
|
180
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
181
|
+
I3S: https://www.i3s.unice.fr/en/
|
182
|
+
iBV: http://ibv.unice.fr/
|
183
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
184
|
+
"""
|
logger_36/type/issue.py
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import logging as lggg
|
8
|
+
import typing as h
|
9
|
+
|
10
|
+
from logger_36.config.issue import ISSUE_BASE_CONTEXT
|
11
|
+
from logger_36.constant.generic import NOT_PASSED
|
12
|
+
from logger_36.constant.issue import ISSUE_LEVEL_SEPARATOR
|
13
|
+
from logger_36.constant.message import expected_op_h
|
14
|
+
from logger_36.task.format.message import MessageWithActualExpected
|
15
|
+
|
16
|
+
issue_t = str
|
17
|
+
|
18
|
+
|
19
|
+
def NewIssue(
|
20
|
+
context: str,
|
21
|
+
separator: str,
|
22
|
+
message: str,
|
23
|
+
/,
|
24
|
+
*,
|
25
|
+
level: int = lggg.ERROR,
|
26
|
+
actual: h.Any = NOT_PASSED,
|
27
|
+
expected: h.Any | None = None,
|
28
|
+
expected_is_choices: bool = False,
|
29
|
+
expected_op: expected_op_h = "=",
|
30
|
+
with_final_dot: bool = True,
|
31
|
+
) -> issue_t:
|
32
|
+
""""""
|
33
|
+
if context.__len__() == 0:
|
34
|
+
context = ISSUE_BASE_CONTEXT
|
35
|
+
message = MessageWithActualExpected(
|
36
|
+
message,
|
37
|
+
actual=actual,
|
38
|
+
expected=expected,
|
39
|
+
expected_is_choices=expected_is_choices,
|
40
|
+
expected_op=expected_op,
|
41
|
+
with_final_dot=with_final_dot,
|
42
|
+
)
|
43
|
+
|
44
|
+
return f"{level}{ISSUE_LEVEL_SEPARATOR}{context}{separator}{message}"
|
45
|
+
|
46
|
+
|
47
|
+
"""
|
48
|
+
COPYRIGHT NOTICE
|
49
|
+
|
50
|
+
This software is governed by the CeCILL license under French law and
|
51
|
+
abiding by the rules of distribution of free software. You can use,
|
52
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
53
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
54
|
+
"http://www.cecill.info".
|
55
|
+
|
56
|
+
As a counterpart to the access to the source code and rights to copy,
|
57
|
+
modify and redistribute granted by the license, users are provided only
|
58
|
+
with a limited warranty and the software's author, the holder of the
|
59
|
+
economic rights, and the successive licensors have only limited
|
60
|
+
liability.
|
61
|
+
|
62
|
+
In this respect, the user's attention is drawn to the risks associated
|
63
|
+
with loading, using, modifying and/or developing or reproducing the
|
64
|
+
software by the user in light of its specific status of free software,
|
65
|
+
that may mean that it is complicated to manipulate, and that also
|
66
|
+
therefore means that it is reserved for developers and experienced
|
67
|
+
professionals having in-depth computer knowledge. Users are therefore
|
68
|
+
encouraged to load and test the software's suitability as regards their
|
69
|
+
requirements in conditions enabling the security of their systems and/or
|
70
|
+
data to be ensured and, more generally, to use and operate it in the
|
71
|
+
same conditions as regards security.
|
72
|
+
|
73
|
+
The fact that you are presently reading this means that you have had
|
74
|
+
knowledge of the CeCILL license and that you accept its terms.
|
75
|
+
|
76
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
77
|
+
|
78
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
79
|
+
member of team Morpheme.
|
80
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
81
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
82
|
+
I3S, and Laboratory iBV.
|
83
|
+
|
84
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
85
|
+
Inria: https://www.inria.fr/en/
|
86
|
+
UniCA: https://univ-cotedazur.eu/
|
87
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
88
|
+
I3S: https://www.i3s.unice.fr/en/
|
89
|
+
iBV: http://ibv.unice.fr/
|
90
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
91
|
+
"""
|