cq: Format with black and isort

This commit is contained in:
Philipp Hörist
2025-01-25 19:15:37 +01:00
parent e6e71d82bf
commit 841b1fb25e
44 changed files with 1641 additions and 1660 deletions

View File

@@ -14,24 +14,23 @@
# You should have received a copy of the GNU General Public License
# along with OpenPGP Gajim Plugin. If not, see <http://www.gnu.org/licenses/>.
from enum import IntEnum
from collections import namedtuple
from enum import IntEnum
from nbxmpp.namespaces import Namespace
ENCRYPTION_NAME = 'OpenPGP'
ENCRYPTION_NAME = "OpenPGP"
NOT_ENCRYPTED_TAGS = [
('no-store', Namespace.HINTS),
('store', Namespace.HINTS),
('no-copy', Namespace.HINTS),
('no-permanent-store', Namespace.HINTS),
('origin-id', Namespace.SID),
('thread', None)
("no-store", Namespace.HINTS),
("store", Namespace.HINTS),
("no-copy", Namespace.HINTS),
("no-permanent-store", Namespace.HINTS),
("origin-id", Namespace.SID),
("thread", None),
]
Key = namedtuple('Key', 'fingerprint date')
Key = namedtuple("Key", "fingerprint date")
class Trust(IntEnum):
@@ -42,8 +41,8 @@ class Trust(IntEnum):
def prepare_stanza(stanza, payload):
delete_nodes(stanza, 'openpgp', Namespace.OPENPGP)
delete_nodes(stanza, 'body')
delete_nodes(stanza, "openpgp", Namespace.OPENPGP)
delete_nodes(stanza, "body")
nodes = [(node.getName(), node.getNamespace()) for node in payload]
for name, namespace in nodes:
@@ -56,7 +55,7 @@ def prepare_stanza(stanza, payload):
def delete_nodes(stanza, name, namespace=None):
attrs = None
if namespace is not None:
attrs = {'xmlns': Namespace.OPENPGP}
attrs = {"xmlns": Namespace.OPENPGP}
nodes = stanza.getTags(name, attrs)
for node in nodes:
stanza.delChild(node)