src/eric7/Utilities/ClassBrowsers/pyclbr.py

branch
eric7
changeset 9500
5771348ded12
parent 9490
77b8d3a635b7
child 9502
6091145e189e
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Wed Nov 09 11:32:13 2022 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Wed Nov 09 15:05:06 2022 +0100
@@ -13,6 +13,7 @@
 import re
 import sys
 
+from dataclasses import dataclass
 from functools import reduce
 
 from eric7 import Utilities
@@ -245,27 +246,17 @@
         VisibilityMixin.__init__(self)
 
 
+@dataclass
 class Publics:
     """
     Class to represent the list of public identifiers.
     """
 
-    def __init__(self, module, file, lineno, idents):
-        """
-        Constructor
-
-        @param module name of the module containing this function
-        @param file filename containing this class
-        @param lineno linenumber of the class definition
-        @param idents list of public identifiers
-        """
-        self.module = module
-        self.name = "__all__"
-        self.file = file
-        self.lineno = lineno
-        self.identifiers = [
-            e.replace('"', "").replace("'", "").strip() for e in idents.split(",")
-        ]
+    module: str
+    file: str
+    lineno: int
+    identifiers: list[str]
+    name: str = "__all__"
 
 
 class Imports:
@@ -682,7 +673,15 @@
             idents = m.group("Identifiers")
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
-            pubs = Publics(module, file, lineno, idents)
+            pubs = Publics(
+                module=module,
+                file=file,
+                lineno=lineno,
+                identifiers=[
+                    e.replace('"', "").replace("'", "").strip()
+                    for e in idents.split(",")
+                ]
+            )
             dictionary["__all__"] = pubs
 
         elif m.start("Import") >= 0:

eric ide

mercurial