Skip to content

Commit 965737f

Browse files
committed
formatting with autopep8
1 parent 66eeab6 commit 965737f

File tree

4 files changed

+217
-107
lines changed

4 files changed

+217
-107
lines changed

gen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ def main():
400400
print("No argtypes...", func.__name__)
401401
continue
402402

403-
fparams = [f"{param}: {map_type(typ)}" for param, typ in zip(*zip_params)]
403+
fparams = [
404+
f"{param}: {map_type(typ)}" for param, typ in zip(*zip_params)]
404405
restype: type["ctypes._CData"] = func.restype # type: ignore
405406

406407
name_split = k.split("_")

src/_pointers.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ from typing import Any, Callable, TypeVar
22

33
_T = TypeVar("_T")
44

5+
56
def add_ref(obj: Any) -> None: ...
67
def remove_ref(obj: Any) -> None: ...
78
def force_set_attr(typ: type[Any], key: str, value: Any) -> None: ...
89
def set_ref(obj: Any, count: int) -> None: ...
10+
11+
912
def handle(
1013
func: Callable[..., _T],
1114
args: tuple[Any, ...] | None = None,

src/pointers/_pyapi.py

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ class PyCodeObject(ctypes.Structure):
399399
),
400400
)
401401
# PyObject* PyCodec_BackslashReplaceErrors(PyObject* exc)
402-
_register("PyCodec_BackslashReplaceErrors", ctypes.py_object, (ctypes.py_object,))
402+
_register("PyCodec_BackslashReplaceErrors",
403+
ctypes.py_object, (ctypes.py_object,))
403404
# PyObject* PyCodec_Decode(PyObject* object, const char* encoding, const char* errors)
404405
_register(
405406
"PyCodec_Decode",
@@ -498,7 +499,8 @@ class PyCodeObject(ctypes.Structure):
498499
minver="3.10",
499500
)
500501
# PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject* exc)
501-
_register("PyCodec_XMLCharRefReplaceErrors", ctypes.py_object, (ctypes.py_object,))
502+
_register("PyCodec_XMLCharRefReplaceErrors",
503+
ctypes.py_object, (ctypes.py_object,))
502504
# PyObject* PyComplex_FromDoubles(double real, double imag)
503505
_register(
504506
"PyComplex_FromDoubles",
@@ -513,13 +515,17 @@ class PyCodeObject(ctypes.Structure):
513515
# double PyComplex_RealAsDouble(PyObject* op)
514516
_register("PyComplex_RealAsDouble", ctypes.c_double, (ctypes.py_object,))
515517
# PyObject* PyDescr_NewClassMethod(PyTypeObject* type, PyMethodDef* method)
516-
_register("PyDescr_NewClassMethod", ctypes.py_object, (ctypes.POINTER(PyTypeObject),))
518+
_register("PyDescr_NewClassMethod", ctypes.py_object,
519+
(ctypes.POINTER(PyTypeObject),))
517520
# PyObject* PyDescr_NewGetSet(PyTypeObject* type, struct PyGetSetDef* getset)
518-
_register("PyDescr_NewGetSet", ctypes.py_object, (ctypes.POINTER(PyTypeObject),))
521+
_register("PyDescr_NewGetSet", ctypes.py_object,
522+
(ctypes.POINTER(PyTypeObject),))
519523
# PyObject* PyDescr_NewMember(PyTypeObject* type, struct PyMemberDef* meth)
520-
_register("PyDescr_NewMember", ctypes.py_object, (ctypes.POINTER(PyTypeObject),))
524+
_register("PyDescr_NewMember", ctypes.py_object,
525+
(ctypes.POINTER(PyTypeObject),))
521526
# PyObject* PyDescr_NewMethod(PyTypeObject* type, struct PyMethodDef* meth)
522-
_register("PyDescr_NewMethod", ctypes.py_object, (ctypes.POINTER(PyTypeObject),))
527+
_register("PyDescr_NewMethod", ctypes.py_object,
528+
(ctypes.POINTER(PyTypeObject),))
523529
# PyObject* PyDictProxy_New(PyObject* mapping)
524530
_register("PyDictProxy_New", ctypes.py_object, (ctypes.py_object,))
525531
# void PyDict_Clear(PyObject* p)
@@ -1003,7 +1009,8 @@ class PyCodeObject(ctypes.Structure):
10031009
),
10041010
)
10051011
# PyObject* PyEval_EvalFrame(PyFrameObject* f)
1006-
_register("PyEval_EvalFrame", ctypes.py_object, (ctypes.POINTER(PyFrameObject),))
1012+
_register("PyEval_EvalFrame", ctypes.py_object,
1013+
(ctypes.POINTER(PyFrameObject),))
10071014
# PyObject* PyEval_EvalFrameEx(PyFrameObject* f, int throwflag)
10081015
_register(
10091016
"PyEval_EvalFrameEx",
@@ -1133,7 +1140,8 @@ class PyCodeObject(ctypes.Structure):
11331140
minver="3.9",
11341141
)
11351142
# int PyFrame_GetLineNumber(PyFrameObject* frame)
1136-
_register("PyFrame_GetLineNumber", ctypes.c_int, (ctypes.POINTER(PyFrameObject),))
1143+
_register("PyFrame_GetLineNumber", ctypes.c_int,
1144+
(ctypes.POINTER(PyFrameObject),))
11371145
# PyObject* PyFrozenSet_New(PyObject* iterable)
11381146
_register("PyFrozenSet_New", ctypes.py_object, (ctypes.py_object,))
11391147
# Py_ssize_t PyGC_Collect(void)
@@ -1280,9 +1288,11 @@ class PyCodeObject(ctypes.Structure):
12801288
# int PyIndex_Check(PyObject* o)
12811289
_register("PyIndex_Check", ctypes.c_int, (ctypes.py_object,))
12821290
# void PyInterpreterState_Clear(PyInterpreterState* interp)
1283-
_register("PyInterpreterState_Clear", None, (ctypes.POINTER(PyInterpreterState),))
1291+
_register("PyInterpreterState_Clear", None,
1292+
(ctypes.POINTER(PyInterpreterState),))
12841293
# void PyInterpreterState_Delete(PyInterpreterState* interp)
1285-
_register("PyInterpreterState_Delete", None, (ctypes.POINTER(PyInterpreterState),))
1294+
_register("PyInterpreterState_Delete", None,
1295+
(ctypes.POINTER(PyInterpreterState),))
12861296
# PyInterpreterState* PyInterpreterState_Get(void)
12871297
_register(
12881298
"PyInterpreterState_Get",
@@ -1413,7 +1423,8 @@ class PyCodeObject(ctypes.Structure):
14131423
# unsigned long long PyLong_AsUnsignedLongLong(PyObject* pylong)
14141424
_register("PyLong_AsUnsignedLongLong", ctypes.c_ulonglong, (ctypes.py_object,))
14151425
# unsigned long long PyLong_AsUnsignedLongLongMask(PyObject* obj)
1416-
_register("PyLong_AsUnsignedLongLongMask", ctypes.c_ulonglong, (ctypes.py_object,))
1426+
_register("PyLong_AsUnsignedLongLongMask",
1427+
ctypes.c_ulonglong, (ctypes.py_object,))
14171428
# unsigned long PyLong_AsUnsignedLongMask(PyObject* obj)
14181429
_register("PyLong_AsUnsignedLongMask", ctypes.c_ulong, (ctypes.py_object,))
14191430
# void* PyLong_AsVoidPtr(PyObject* pylong)
@@ -1441,7 +1452,8 @@ class PyCodeObject(ctypes.Structure):
14411452
# PyObject* PyLong_FromUnsignedLong(unsigned long v)
14421453
_register("PyLong_FromUnsignedLong", ctypes.py_object, (ctypes.c_ulong,))
14431454
# PyObject* PyLong_FromUnsignedLongLong(unsigned long long v)
1444-
_register("PyLong_FromUnsignedLongLong", ctypes.py_object, (ctypes.c_ulonglong,))
1455+
_register("PyLong_FromUnsignedLongLong",
1456+
ctypes.py_object, (ctypes.c_ulonglong,))
14451457
# PyObject* PyLong_FromVoidPtr(void* p)
14461458
_register("PyLong_FromVoidPtr", ctypes.py_object, (ctypes.c_void_p,))
14471459
# int PyMapping_Check(PyObject* o)
@@ -1517,7 +1529,8 @@ class PyCodeObject(ctypes.Structure):
15171529
),
15181530
)
15191531
# PyObject* PyMemoryView_FromBuffer(const Py_buffer* view)
1520-
_register("PyMemoryView_FromBuffer", ctypes.py_object, (ctypes.POINTER(Py_buffer),))
1532+
_register("PyMemoryView_FromBuffer", ctypes.py_object,
1533+
(ctypes.POINTER(Py_buffer),))
15211534
# PyObject* PyMemoryView_FromMemory(char* mem, Py_ssize_t size, int flags)
15221535
_register(
15231536
"PyMemoryView_FromMemory",
@@ -2634,7 +2647,8 @@ class PyCodeObject(ctypes.Structure):
26342647
minver="3.3",
26352648
)
26362649
# PyObject* PyState_FindModule(PyModuleDef* def)
2637-
_register("PyState_FindModule", ctypes.py_object, (ctypes.POINTER(PyModuleDef),))
2650+
_register("PyState_FindModule", ctypes.py_object,
2651+
(ctypes.POINTER(PyModuleDef),))
26382652
# int PyState_RemoveModule(PyModuleDef* def)
26392653
_register(
26402654
"PyState_RemoveModule",
@@ -2652,7 +2666,8 @@ class PyCodeObject(ctypes.Structure):
26522666
),
26532667
)
26542668
# PyObject* PyStructSequence_New(PyTypeObject* type)
2655-
_register("PyStructSequence_New", ctypes.py_object, (ctypes.POINTER(PyTypeObject),))
2669+
_register("PyStructSequence_New", ctypes.py_object,
2670+
(ctypes.POINTER(PyTypeObject),))
26562671
# PyTypeObject* PyStructSequence_NewType(PyStructSequence_Desc* desc)
26572672
_register("PyStructSequence_NewType", ctypes.POINTER(PyTypeObject), ())
26582673
# void PyStructSequence_SetItem(PyObject* p, Py_ssize_t pos, PyObject* o)
@@ -2975,7 +2990,8 @@ class PyCodeObject(ctypes.Structure):
29752990
),
29762991
)
29772992
# PyObject* PyUnicodeDecodeError_GetEncoding(PyObject* exc)
2978-
_register("PyUnicodeDecodeError_GetEncoding", ctypes.py_object, (ctypes.py_object,))
2993+
_register("PyUnicodeDecodeError_GetEncoding",
2994+
ctypes.py_object, (ctypes.py_object,))
29792995
# int PyUnicodeDecodeError_GetEnd(PyObject* exc, Py_ssize_t* end)
29802996
_register(
29812997
"PyUnicodeDecodeError_GetEnd",
@@ -2986,9 +3002,11 @@ class PyCodeObject(ctypes.Structure):
29863002
),
29873003
)
29883004
# PyObject* PyUnicodeDecodeError_GetObject(PyObject* exc)
2989-
_register("PyUnicodeDecodeError_GetObject", ctypes.py_object, (ctypes.py_object,))
3005+
_register("PyUnicodeDecodeError_GetObject",
3006+
ctypes.py_object, (ctypes.py_object,))
29903007
# PyObject* PyUnicodeDecodeError_GetReason(PyObject* exc)
2991-
_register("PyUnicodeDecodeError_GetReason", ctypes.py_object, (ctypes.py_object,))
3008+
_register("PyUnicodeDecodeError_GetReason",
3009+
ctypes.py_object, (ctypes.py_object,))
29923010
# int PyUnicodeDecodeError_GetStart(PyObject* exc, Py_ssize_t* start)
29933011
_register(
29943012
"PyUnicodeDecodeError_GetStart",
@@ -3026,7 +3044,8 @@ class PyCodeObject(ctypes.Structure):
30263044
),
30273045
)
30283046
# PyObject* PyUnicodeEncodeError_GetEncoding(PyObject* exc)
3029-
_register("PyUnicodeEncodeError_GetEncoding", ctypes.py_object, (ctypes.py_object,))
3047+
_register("PyUnicodeEncodeError_GetEncoding",
3048+
ctypes.py_object, (ctypes.py_object,))
30303049
# int PyUnicodeEncodeError_GetEnd(PyObject* exc, Py_ssize_t* end)
30313050
_register(
30323051
"PyUnicodeEncodeError_GetEnd",
@@ -3037,9 +3056,11 @@ class PyCodeObject(ctypes.Structure):
30373056
),
30383057
)
30393058
# PyObject* PyUnicodeEncodeError_GetObject(PyObject* exc)
3040-
_register("PyUnicodeEncodeError_GetObject", ctypes.py_object, (ctypes.py_object,))
3059+
_register("PyUnicodeEncodeError_GetObject",
3060+
ctypes.py_object, (ctypes.py_object,))
30413061
# PyObject* PyUnicodeEncodeError_GetReason(PyObject* exc)
3042-
_register("PyUnicodeEncodeError_GetReason", ctypes.py_object, (ctypes.py_object,))
3062+
_register("PyUnicodeEncodeError_GetReason",
3063+
ctypes.py_object, (ctypes.py_object,))
30433064
# int PyUnicodeEncodeError_GetStart(PyObject* exc, Py_ssize_t* start)
30443065
_register(
30453066
"PyUnicodeEncodeError_GetStart",
@@ -3086,9 +3107,11 @@ class PyCodeObject(ctypes.Structure):
30863107
),
30873108
)
30883109
# PyObject* PyUnicodeTranslateError_GetObject(PyObject* exc)
3089-
_register("PyUnicodeTranslateError_GetObject", ctypes.py_object, (ctypes.py_object,))
3110+
_register("PyUnicodeTranslateError_GetObject",
3111+
ctypes.py_object, (ctypes.py_object,))
30903112
# PyObject* PyUnicodeTranslateError_GetReason(PyObject* exc)
3091-
_register("PyUnicodeTranslateError_GetReason", ctypes.py_object, (ctypes.py_object,))
3113+
_register("PyUnicodeTranslateError_GetReason",
3114+
ctypes.py_object, (ctypes.py_object,))
30923115
# int PyUnicodeTranslateError_GetStart(PyObject* exc, Py_ssize_t* start)
30933116
_register(
30943117
"PyUnicodeTranslateError_GetStart",
@@ -3151,7 +3174,8 @@ class PyCodeObject(ctypes.Structure):
31513174
# PyObject* PyUnicode_AsMBCSString(PyObject* unicode)
31523175
_register("PyUnicode_AsMBCSString", ctypes.py_object, (ctypes.py_object,))
31533176
# PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject* unicode)
3154-
_register("PyUnicode_AsRawUnicodeEscapeString", ctypes.py_object, (ctypes.py_object,))
3177+
_register("PyUnicode_AsRawUnicodeEscapeString",
3178+
ctypes.py_object, (ctypes.py_object,))
31553179
# Py_UCS4* PyUnicode_AsUCS4(PyObject* u, Py_UCS4* buffer, Py_ssize_t buflen, int copy_null)
31563180
_register(
31573181
"PyUnicode_AsUCS4",
@@ -3188,7 +3212,8 @@ class PyCodeObject(ctypes.Structure):
31883212
# PyObject* PyUnicode_AsUTF8String(PyObject* unicode)
31893213
_register("PyUnicode_AsUTF8String", ctypes.py_object, (ctypes.py_object,))
31903214
# PyObject* PyUnicode_AsUnicodeEscapeString(PyObject* unicode)
3191-
_register("PyUnicode_AsUnicodeEscapeString", ctypes.py_object, (ctypes.py_object,))
3215+
_register("PyUnicode_AsUnicodeEscapeString",
3216+
ctypes.py_object, (ctypes.py_object,))
31923217
# Py_ssize_t PyUnicode_AsWideChar(PyObject* unicode, wchar_t* w, Py_ssize_t size)
31933218
_register(
31943219
"PyUnicode_AsWideChar",

0 commit comments

Comments
 (0)
close