Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-flexparser for 
openSUSE:Factory checked in at 2024-11-13 15:28:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flexparser (Old)
 and      /work/SRC/openSUSE:Factory/.python-flexparser.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flexparser"

Wed Nov 13 15:28:22 2024 rev:3 rq:1223757 version:0.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flexparser/python-flexparser.changes      
2024-09-24 17:34:38.512509321 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-flexparser.new.2017/python-flexparser.changes
    2024-11-13 15:28:49.458623180 +0100
@@ -1,0 +2,6 @@
+Tue Nov 12 11:47:54 UTC 2024 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- Update to 0.4
+  * Exceptions are not longer dataclasses.
+
+-------------------------------------------------------------------

Old:
----
  flexparser-0.3.1.tar.gz

New:
----
  flexparser-0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flexparser.spec ++++++
--- /var/tmp/diff_new_pack.hiri9M/_old  2024-11-13 15:28:50.914683999 +0100
+++ /var/tmp/diff_new_pack.hiri9M/_new  2024-11-13 15:28:50.934684834 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-flexparser
-Version:        0.3.1
+Version:        0.4
 Release:        0
 Summary:        Parsing made fun ... using typing
 License:        BSD-3-Clause

++++++ flexparser-0.3.1.tar.gz -> flexparser-0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/.github/workflows/ci.yml 
new/flexparser-0.4/.github/workflows/ci.yml
--- old/flexparser-0.3.1/.github/workflows/ci.yml       2024-06-06 
02:53:22.000000000 +0200
+++ new/flexparser-0.4/.github/workflows/ci.yml 2024-11-07 03:00:41.000000000 
+0100
@@ -6,7 +6,7 @@
   test-linux:
     strategy:
       matrix:
-        python-version: [3.9, '3.10', '3.11', '3.12']
+        python-version: [3.9, '3.10', '3.11', '3.12', '3.13']
 
     runs-on: ubuntu-latest
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/.pre-commit-config.yaml 
new/flexparser-0.4/.pre-commit-config.yaml
--- old/flexparser-0.3.1/.pre-commit-config.yaml        2024-06-06 
02:53:22.000000000 +0200
+++ new/flexparser-0.4/.pre-commit-config.yaml  2024-11-07 03:00:41.000000000 
+0100
@@ -5,11 +5,13 @@
     -   id: check-yaml
     -   id: end-of-file-fixer
     -   id: trailing-whitespace
--   repo: https://github.com/charliermarsh/ruff-pre-commit
-    rev: v0.1.5
-    hooks:
+- repo: https://github.com/astral-sh/ruff-pre-commit
+  # Ruff version.
+  rev: v0.7.2
+  hooks:
+    # Run the linter.
     - id: ruff
-      args: ["--fix"]
+    # Run the formatter.
     - id: ruff-format
 -   repo: https://github.com/executablebooks/mdformat
     rev: 0.7.16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/CHANGES new/flexparser-0.4/CHANGES
--- old/flexparser-0.3.1/CHANGES        2024-06-06 02:53:22.000000000 +0200
+++ new/flexparser-0.4/CHANGES  2024-11-07 03:00:41.000000000 +0100
@@ -1,6 +1,12 @@
 flexparser Changelog
 ====================
 
+0.4 (2024-11-06)
+----------------
+
+- Exceptions are not longer dataclasses.
+
+
 0.3.1 (2024-06-05)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/PKG-INFO new/flexparser-0.4/PKG-INFO
--- old/flexparser-0.3.1/PKG-INFO       2024-06-06 02:53:30.637954700 +0200
+++ new/flexparser-0.4/PKG-INFO 2024-11-07 03:00:45.309066300 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flexparser
-Version: 0.3.1
+Version: 0.4
 Summary: Parsing made fun ... using typing.
 Author-email: "Hernan E. Grecco" <hernan.gre...@gmail.com>
 Maintainer-email: "Hernan E. Grecco" <hernan.gre...@gmail.com>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/flexparser/__init__.py 
new/flexparser-0.4/flexparser/__init__.py
--- old/flexparser-0.3.1/flexparser/__init__.py 2024-06-06 02:53:22.000000000 
+0200
+++ new/flexparser-0.4/flexparser/__init__.py   2024-11-07 03:00:41.000000000 
+0100
@@ -1,17 +1,18 @@
 """
-    flexparser
-    ~~~~~~~~~
+flexparser
+~~~~~~~~~
 
-    Classes and functions to create parsers.
+Classes and functions to create parsers.
 
-    The idea is quite simple. You write a class for every type of content
-    (called here ``ParsedStatement``) you need to parse. Each class should
-    have a ``from_string`` constructor. We used extensively the ``typing``
-    module to make the output structure easy to use and less error prone.
+The idea is quite simple. You write a class for every type of content
+(called here ``ParsedStatement``) you need to parse. Each class should
+have a ``from_string`` constructor. We used extensively the ``typing``
+module to make the output structure easy to use and less error prone.
 
-    :copyright: 2022 by flexparser Authors, see AUTHORS for more details.
-    :license: BSD, see LICENSE for more details.
+:copyright: 2022 by flexparser Authors, see AUTHORS for more details.
+:license: BSD, see LICENSE for more details.
 """
+
 from __future__ import annotations
 
 from importlib.metadata import version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/flexparser/flexparser.py 
new/flexparser-0.4/flexparser/flexparser.py
--- old/flexparser-0.3.1/flexparser/flexparser.py       2024-06-06 
02:53:22.000000000 +0200
+++ new/flexparser-0.4/flexparser/flexparser.py 2024-11-07 03:00:41.000000000 
+0100
@@ -1,18 +1,18 @@
 """
-    flexparser.flexparser
-    ~~~~~~~~~~~~~~~~~~~~~
+flexparser.flexparser
+~~~~~~~~~~~~~~~~~~~~~
 
-    Classes and functions to create parsers.
+Classes and functions to create parsers.
 
-    The idea is quite simple. You write a class for every type of content
-    (called here ``ParsedStatement``) you need to parse. Each class should
-    have a ``from_string`` constructor. We used extensively the ``typing``
-    module to make the output structure easy to use and less error prone.
+The idea is quite simple. You write a class for every type of content
+(called here ``ParsedStatement``) you need to parse. Each class should
+have a ``from_string`` constructor. We used extensively the ``typing``
+module to make the output structure easy to use and less error prone.
 
-    For more information, take a look at https://github.com/hgrecco/flexparser
+For more information, take a look at https://github.com/hgrecco/flexparser
 
-    :copyright: 2022 by flexparser Authors, see AUTHORS for more details.
-    :license: BSD, see LICENSE for more details.
+:copyright: 2022 by flexparser Authors, see AUTHORS for more details.
+:license: BSD, see LICENSE for more details.
 """
 
 from __future__ import annotations
@@ -75,13 +75,15 @@
     warnings.warn(msg)
 
 
+class HasherAlgorithm(ty.Protocol):
+    def __call__(self, b: bytes, usedforsecurity: bool) -> HasherProtocol: ...
+
+
 class HasherProtocol(ty.Protocol):
     @property
-    def name(self) -> str:
-        ...
+    def name(self) -> str: ...
 
-    def hexdigest(self) -> str:
-        ...
+    def hexdigest(self) -> str: ...
 
 
 class GenericInfo:
@@ -220,33 +222,106 @@
         return self.set_position(line, col, line, col + width)
 
 
-@dataclass(frozen=True)
-class ParsingError(Statement, Exception):
+class ParsingError(Exception):
     """Base class for all parsing exceptions in this package."""
 
+    _statement: Statement | None = None
+
     def __str__(self) -> str:
-        return Statement.__str__(self)
+        cv: str = self.custom_values_str()
+        if cv:
+            cv = ", " + cv
+        return self.__class__.__name__ + str(self.statement)[9:-1] + cv + ")"
+
+    def custom_values_str(self) -> str:
+        return ""
+
+    def __eq__(self, other: Any) -> bool:
+        if not isinstance(other, ParsingError):
+            return False
+        return self.statement == other.statement
+
+    @property
+    def statement(self) -> Statement:
+        if self._statement is None:
+            self._statement = Statement()
+        return self._statement
+
+    @statement.setter
+    def statement(self, value: Statement):
+        self._statement = value
+
+    @property
+    def is_position_set(self) -> bool:
+        return self.statement.is_position_set
+
+    @property
+    def start_line(self) -> int:
+        return self.statement.start_line
+
+    @property
+    def start_col(self) -> int:
+        return self.statement.start_col
+
+    @property
+    def end_line(self) -> int:
+        return self.statement.end_line
+
+    @property
+    def end_col(self) -> int:
+        return self.statement.end_col
+
+    @property
+    def raw(self) -> Optional[str]:
+        return self.statement.raw
+
+    @property
+    def format_position(self) -> str:
+        return self.statement.format_position
+
+    @property
+    def raw_strip(self) -> Optional[str]:
+        return self.statement.raw_strip
+
+    def get_position(self) -> tuple[int, int, int, int]:
+        return self.statement.get_position()
+
+    def set_position(
+        self: Self, start_line: int, start_col: int, end_line: int, end_col: 
int
+    ) -> Self:
+        self.statement.set_position(start_line, start_col, end_line, end_col)
+        return self
+
+    def set_raw(self: Self, raw: str) -> Self:
+        self.statement.set_raw(raw)
+        return self
+
+    def set_simple_position(self: Self, line: int, col: int, width: int) -> 
Self:
+        return self.set_position(line, col, line, col + width)
 
 
-@dataclass(frozen=True)
 class UnknownStatement(ParsingError):
     """A string statement could not bee parsed."""
 
     def __str__(self) -> str:
-        return f"Could not parse '{self.raw}' ({self.format_position})"
+        return (
+            f"Could not parse '{self.statement.raw}' 
({self.statement.format_position})"
+        )
 
 
-@dataclass(frozen=True)
 class UnhandledParsingError(ParsingError):
     """Base class for all parsing exceptions in this package."""
 
-    ex: Exception
+    exception: Exception
+
+    def __init__(self, statement: Statement, exception: Exception) -> None:
+        super().__init__(statement)
+        self.exception = exception
 
     def __str__(self) -> str:
-        return f"Unhandled exception while parsing '{self.raw}' 
({self.format_position}): {self.ex}"
+        return f"Unhandled exception while parsing '{self.statement.raw}' 
({self.statement.format_position}): {self.exception}"
 
 
-@dataclass(frozen=True)
 class UnexpectedEOS(ParsingError):
     """End of file was found within an open block."""
 
@@ -272,12 +347,7 @@
     @classmethod
     def from_bytes(
         cls,
-        algorithm: ty.Callable[
-            [
-                bytes,
-            ],
-            HasherProtocol,
-        ],
+        algorithm: HasherAlgorithm,
         b: bytes,
     ) -> Self:
         hasher = algorithm(b, usedforsecurity=False)
@@ -286,12 +356,7 @@
     @classmethod
     def from_file_pointer(
         cls,
-        algorithm: ty.Callable[
-            [
-                bytes,
-            ],
-            HasherProtocol,
-        ],
+        algorithm: HasherAlgorithm,
         fp: ty.BinaryIO,
     ) -> Self:
         return cls.from_bytes(algorithm, fp.read())
@@ -669,30 +734,24 @@
 
 class ConsumeProtocol(ty.Protocol):
     @property
-    def is_position_set(self) -> bool:
-        ...
+    def is_position_set(self) -> bool: ...
 
     @property
-    def start_line(self) -> int:
-        ...
+    def start_line(self) -> int: ...
 
     @property
-    def start_col(self) -> int:
-        ...
+    def start_col(self) -> int: ...
 
     @property
-    def end_line(self) -> int:
-        ...
+    def end_line(self) -> int: ...
 
     @property
-    def end_col(self) -> int:
-        ...
+    def end_col(self) -> int: ...
 
     @classmethod
     def consume(
         cls, statement_iterator: StatementIterator, config: Any
-    ) -> NullableParsedResult[Self]:
-        ...
+    ) -> NullableParsedResult[Self]: ...
 
 
 @dataclass(frozen=True)
@@ -748,7 +807,7 @@
         try:
             out = cls.from_string_and_config(raw, config)
         except Exception as ex:
-            out = UnhandledParsingError(ex)
+            out = UnhandledParsingError(statement, ex)
 
         if out is None:
             return None
@@ -931,8 +990,9 @@
             el = c.consume(statement_iterator, config)
             if el is not None:
                 return el
-        unkel = next(statement_iterator)
-        return UnknownStatement.from_statement(unkel)
+        parsing_error = UnknownStatement()
+        parsing_error.statement = next(statement_iterator)
+        return parsing_error
 
     @classmethod
     def consume_closing(
@@ -991,7 +1051,9 @@
 
     @classmethod
     def on_stop_iteration(cls, config: CT) -> ParsedResult[EOS[CT]]:
-        return UnexpectedEOS()
+        unexpected_eos = UnexpectedEOS()
+        unexpected_eos.statement = Statement()
+        return unexpected_eos
 
 
 @dataclass(frozen=True)
@@ -1139,12 +1201,7 @@
     _prefer_resource_as_file: bool
 
     #: parser algorithm to us. Must be a callable member of hashlib
-    _hasher: ty.Callable[
-        [
-            bytes,
-        ],
-        HasherProtocol,
-    ] = _DEFAULT_HASHER
+    _hasher: HasherAlgorithm = _DEFAULT_HASHER
 
     def __init__(self, config: CT, prefer_resource_as_file: bool = True):
         self._config = config
@@ -1455,8 +1512,8 @@
     delimiters: Optional[DelimiterDictT] = None,
 ) -> type[Parser[RootBlock[BPST, CT], CT]]:
     class CustomParser(Parser[spec, spec.specialization()[CT]]):  # type: 
ignore
-        _delimiters: DelimiterDictT = delimiters or SPLIT_EOL
-        _strip_spaces: bool = strip_spaces
+        _delimiters: DelimiterDictT = delimiters or SPLIT_EOL  # type: ignore
+        _strip_spaces: bool = strip_spaces  # type: ignore
 
     return CustomParser
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/flexparser/testsuite/common.py 
new/flexparser-0.4/flexparser/testsuite/common.py
--- old/flexparser-0.3.1/flexparser/testsuite/common.py 2024-06-06 
02:53:22.000000000 +0200
+++ new/flexparser-0.4/flexparser/testsuite/common.py   2024-11-07 
03:00:41.000000000 +0100
@@ -18,15 +18,25 @@
 from flexparser import flexparser as fp
 
 
-@dataclass(frozen=True)
 class NotAValidIdentifier(fp.ParsingError):
     value: str
 
+    def __init__(self, value: str) -> None:
+        self.value = value
+
+    def custom_values_str(self) -> str:
+        return f"value='{self.value}'"
+
 
-@dataclass(frozen=True)
 class CannotParseToFloat(fp.ParsingError):
     value: str
 
+    def __init__(self, value: str) -> None:
+        self.value = value
+
+    def custom_values_str(self) -> str:
+        return f"value='{self.value}'"
+
 
 @dataclass(frozen=True)
 class Open(fp.ParsedStatement[None]):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flexparser-0.3.1/flexparser/testsuite/test_element_block.py 
new/flexparser-0.4/flexparser/testsuite/test_element_block.py
--- old/flexparser-0.3.1/flexparser/testsuite/test_element_block.py     
2024-06-06 02:53:22.000000000 +0200
+++ new/flexparser-0.4/flexparser/testsuite/test_element_block.py       
2024-11-07 03:00:41.000000000 +0100
@@ -60,6 +60,7 @@
 
 def test_formatting():
     obj = EqualFloat.from_string("a = 3.1")
+    assert obj is not None
     assert obj.format_position == "N/A"
     obj.set_simple_position(10, 3, 7)
     assert obj.format_position == "10,3-10,10"
@@ -69,6 +70,7 @@
     )
 
     obj = EqualFloat.from_string("%a = 3.1")
+    assert obj is not None
     assert obj.format_position == "N/A"
     obj.set_simple_position(10, 3, 8)
     assert obj.format_position == "10,3-10,11"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/flexparser.egg-info/PKG-INFO 
new/flexparser-0.4/flexparser.egg-info/PKG-INFO
--- old/flexparser-0.3.1/flexparser.egg-info/PKG-INFO   2024-06-06 
02:53:30.000000000 +0200
+++ new/flexparser-0.4/flexparser.egg-info/PKG-INFO     2024-11-07 
03:00:45.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flexparser
-Version: 0.3.1
+Version: 0.4
 Summary: Parsing made fun ... using typing.
 Author-email: "Hernan E. Grecco" <hernan.gre...@gmail.com>
 Maintainer-email: "Hernan E. Grecco" <hernan.gre...@gmail.com>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flexparser-0.3.1/pyproject.toml 
new/flexparser-0.4/pyproject.toml
--- old/flexparser-0.3.1/pyproject.toml 2024-06-06 02:53:22.000000000 +0200
+++ new/flexparser-0.4/pyproject.toml   2024-11-07 03:00:41.000000000 +0100
@@ -49,12 +49,11 @@
 
 [tool.setuptools_scm]
 
-[tool.ruff.isort]
+[tool.ruff.lint.isort]
 required-imports = ["from __future__ import annotations"]
 known-first-party= ["flexparser"]
 
-
-[tool.ruff]
+[tool.ruff.lint]
 extend-select = [
   "I",           # isort
 ]
@@ -69,5 +68,7 @@
   # line break before binary operator
   # "W503"
 ]
+
+[tool.ruff]
 extend-exclude = ["build"]
 line-length=88

Reply via email to