Global reformatting with black.

This commit is contained in:
Goffi 2025-09-13 10:46:10 +02:00
commit 96bf3af324
68 changed files with 557 additions and 561 deletions

View file

@ -2,7 +2,6 @@ from typing import Optional
from twisted.words.xish import domish
class BaseError(Exception):
namespace: str
condition: str
@ -10,5 +9,4 @@ class BaseError(Exception):
textLang: Optional[str]
appCondition: Optional[domish.Element]
class StanzaError(BaseError):
...
class StanzaError(BaseError): ...

View file

@ -1,11 +1,9 @@
from typing import Tuple, overload
User = str
Host = str
Resource = str
# Note: these typings are incomplete and evolve as needed.
class JID:
user: User
@ -13,18 +11,9 @@ class JID:
resource: Resource
@overload
def __init__(self, str: str, tuple: None = None) -> None:
...
def __init__(self, str: str, tuple: None = None) -> None: ...
@overload
def __init__(self, str: None, tuple: Tuple[User, Host, Resource]) -> None:
...
def userhost(self) -> str:
...
def userhostJID(self) -> "JID":
...
def full(self) -> str:
...
def __init__(self, str: None, tuple: Tuple[User, Host, Resource]) -> None: ...
def userhost(self) -> str: ...
def userhostJID(self) -> "JID": ...
def full(self) -> str: ...

View file

@ -1,8 +1,15 @@
from typing import (
Dict, Iterator, List, Literal, Optional, Tuple, TypeVar, Union, overload
Dict,
Iterator,
List,
Literal,
Optional,
Tuple,
TypeVar,
Union,
overload,
)
URI = str
Name = str
QName = Tuple[Optional[URI], Name]
@ -10,10 +17,8 @@ AttributeKey = Union[QName, Name]
Attributes = Dict[AttributeKey, str]
Prefix = str
D = TypeVar("D")
# Note: these typings are incomplete and evolve as needed.
class Element:
uri: Optional[URI]
@ -27,54 +32,31 @@ class Element:
qname: QName,
defaultUri: Optional[URI] = None,
attribs: Optional[Attributes] = None,
localPrefixes: Optional[Dict[URI, Prefix]] = None
) -> None:
...
def __getitem__(self, key: AttributeKey) -> str:
...
def __setitem__(self, key: AttributeKey, value: str) -> None:
...
localPrefixes: Optional[Dict[URI, Prefix]] = None,
) -> None: ...
def __getitem__(self, key: AttributeKey) -> str: ...
def __setitem__(self, key: AttributeKey, value: str) -> None: ...
@overload
def getAttribute(
self,
attribname: AttributeKey,
default: None = None
) -> Union[str, None]:
...
self, attribname: AttributeKey, default: None = None
) -> Union[str, None]: ...
@overload
def getAttribute(self, attribname: AttributeKey, default: D) -> Union[str, D]:
...
def addChild(self, node: "Element") -> "Element":
...
def addContent(self, text: str) -> str:
...
def getAttribute(self, attribname: AttributeKey, default: D) -> Union[str, D]: ...
def addChild(self, node: "Element") -> "Element": ...
def addContent(self, text: str) -> str: ...
def addElement(
self,
name: Union[QName, Name],
defaultUri: Optional[URI] = None,
content: Optional[str] = None
) -> "Element":
...
content: Optional[str] = None,
) -> "Element": ...
def elements(
self,
uri: Optional[URI] = None,
name: Optional[Name] = None
) -> Iterator["Element"]:
...
self, uri: Optional[URI] = None, name: Optional[Name] = None
) -> Iterator["Element"]: ...
def toXml(
self,
prefixes: Optional[Dict[URI, Prefix]] = None,
closeElement: Literal[0, 1] = 1,
defaultUri: str = "",
prefixesInScope: Optional[List[Prefix]] = None
) -> str:
...
prefixesInScope: Optional[List[Prefix]] = None,
) -> str: ...