Skip to content

Commit e18c0c6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b9957e9 commit e18c0c6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/xmlsec/template.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
import ctypes
2+
13
from lxml.etree import _Element
4+
25
from xmlsec.constants import __Transform as Transform
3-
import ctypes
46

57
# Load the shared library (assuming it's named `libxmlsec.so` or similar)
6-
libxmlsec = ctypes.CDLL("../template.c")
8+
libxmlsec = ctypes.CDLL('../template.c')
79

810
# Define the Python wrapper for the C function
911
libxmlsec.PyXmlSec_TemplateAddEncryptedKey.argtypes = [
1012
ctypes.POINTER(_Element), # Assuming _Element is compatible
1113
ctypes.POINTER(Transform),
1214
ctypes.c_char_p, # id
1315
ctypes.c_char_p, # type
14-
ctypes.c_char_p # recipient
16+
ctypes.c_char_p, # recipient
1517
]
1618
libxmlsec.PyXmlSec_TemplateAddEncryptedKey.restype = ctypes.POINTER(_Element)
1719

20+
1821
def add_encrypted_key(
1922
node: _Element, method: Transform, id: str | None = None, type: str | None = None, recipient: str | None = None
2023
) -> _Element:
@@ -37,6 +40,6 @@ def add_encrypted_key(
3740
result = libxmlsec.PyXmlSec_TemplateAddEncryptedKey(node, method, c_id, c_type, c_recipient)
3841

3942
if not result:
40-
raise RuntimeError("Failed to add encrypted key")
43+
raise RuntimeError('Failed to add encrypted key')
4144

4245
return result

0 commit comments

Comments
 (0)