3030from typing import Any , Callable , Dict , Iterator , List , Mapping , Optional , Sequence , Union
3131
3232# 3rd party
33- import attr
33+ import attrs
3434from attr_utils .pprinter import pretty_repr
3535from attr_utils .serialise import serde
3636from domdf_python_tools .typing import PathLike
@@ -78,7 +78,7 @@ class ExpandedHookDict(_BaseExpandedHookDict):
7878
7979@pretty_repr
8080@serde
81- @attr . s
81+ @attrs . define
8282class Hook :
8383 """
8484 Represents a ``formate`` reformatting hook.
@@ -87,21 +87,21 @@ class Hook:
8787 """
8888
8989 #: The name of the hook. The name is normalized into lowercase, with underscores replaced by hyphens.
90- name : str = attr . ib ()
90+ name : str = attrs . field ()
9191
9292 #: The priority of the hook.
93- priority : int = attr . ib (default = 10 )
93+ priority : int = attrs . field (default = 10 )
9494
9595 #: The positional arguments passed to the hook function.
96- args : Sequence [Any ] = attr . ib (default = (), converter = tuple )
96+ args : Sequence [Any ] = attrs . field (default = (), converter = tuple )
9797
9898 #: The keyword arguments passed to the hook function.
99- kwargs : Dict [str , Any ] = attr . ib (default = {})
99+ kwargs : Dict [str , Any ] = attrs . field (default = {})
100100
101- entry_point : Optional ["EntryPoint" ] = attr . ib (default = None )
101+ entry_point : Optional ["EntryPoint" ] = attrs . field (default = None )
102102
103103 #: A read-only view on the global configuration mapping, for hooks to do with as they wish.
104- global_config : Mapping [str , Any ] = attr . ib (factory = dict )
104+ global_config : Mapping [str , Any ] = attrs . field (factory = dict )
105105
106106 @name .validator
107107 def _normalize (self , attribute , value ): # noqa: MAN001,MAN002
@@ -154,17 +154,17 @@ def __call__(self, source: str, filename: PathLike) -> str:
154154
155155
156156@serde
157- @attr . s
157+ @attrs . define
158158class EntryPoint :
159159 """
160160 Represents an entry point for a hook.
161161 """
162162
163163 #: The name of the entry point. The name is normalized into lowercase, with underscores replaced by hyphens.
164- name : str = attr . ib ()
164+ name : str = attrs . field ()
165165
166166 #: The object the entry point refers to.
167- obj : Callable [..., str ] = attr . ib ()
167+ obj : Callable [..., str ] = attrs . field ()
168168
169169 @name .validator
170170 def _normalize (self , attribute , value ): # noqa: MAN001,MAN002
0 commit comments