# HG changeset patch # User Goffi # Date 1733181158 -3600 # Node ID 111dce64dcb5c24898dac18c546bfadf3e130126 # Parent e94799a0908f0fb79ae01762b9e129d242afe33c plugins XEP-0300, XEP-0446, XEP-0447, XEP0448 and others: Refactoring to use Pydantic: Pydantic models are used more and more in Libervia, for the bridge API, and also to convert `domish.Element` to internal representation. Type hints have also been added in many places. rel 453 diff -r e94799a0908f -r 111dce64dcb5 libervia/backend/plugins/plugin_misc_download.py --- a/libervia/backend/plugins/plugin_misc_download.py Tue Dec 03 00:11:00 2024 +0100 +++ b/libervia/backend/plugins/plugin_misc_download.py Tue Dec 03 00:12:38 2024 +0100 @@ -277,12 +277,12 @@ callback: Callable[ [ SatXMPPEntity, - Dict[str, Any], - Dict[str, Any], + dict[str, Any], + dict[str, Any], Union[str, Path], - Dict[str, Any], + dict[str, Any], ], - Tuple[str, defer.Deferred], + tuple[str, defer.Deferred], ], ) -> None: """Register a handler to manage a type of attachment source @@ -295,11 +295,11 @@ source used. The callabke must return a tuple with: - progress ID - - a Deferred which fire whant the file is fully downloaded + - a Deferred which fire when the file is fully downloaded """ - if source_type is self._download_callbacks: + if source_type in self._download_callbacks: raise exceptions.ConflictError( - f"The is already a callback registered for source type {source_type!r}" + f"There is already a callback registered for source type {source_type!r}" ) self._download_callbacks[source_type] = callback diff -r e94799a0908f -r 111dce64dcb5 libervia/backend/plugins/plugin_misc_text_syntaxes.py --- a/libervia/backend/plugins/plugin_misc_text_syntaxes.py Tue Dec 03 00:11:00 2024 +0100 +++ b/libervia/backend/plugins/plugin_misc_text_syntaxes.py Tue Dec 03 00:12:38 2024 +0100 @@ -43,7 +43,7 @@ except ImportError: raise exceptions.MissingModule( 'Missing module "lxml_html_clean". Please download and install it from ' - 'http://lxml.de/. Note that this is a separate package to install in addition ' + "http://lxml.de/. Note that this is a separate package to install in addition " 'to "lxml".' ) diff -r e94799a0908f -r 111dce64dcb5 libervia/backend/plugins/plugin_misc_uri_finder.py --- a/libervia/backend/plugins/plugin_misc_uri_finder.py Tue Dec 03 00:11:00 2024 +0100 +++ b/libervia/backend/plugins/plugin_misc_uri_finder.py Tue Dec 03 00:12:38 2024 +0100 @@ -74,12 +74,12 @@ @return (dict[unicode, unicode]): map from key to found uri """ keys_re = "|".join(keys) - label_re = r'\"(?P