private-attribute-cpp 2.1.16__tar.gz → 2.1.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {private_attribute_cpp-2.1.16/private_attribute_cpp.egg-info → private_attribute_cpp-2.1.18}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute.cpp +144 -62
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute.pyi +6 -5
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/setup.py +1 -1
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/LICENSE +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/MANIFEST.in +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/README.md +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/picosha2.h +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/top_level.txt +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/setup.cfg +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_attr_classify_owner.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_gc_collect.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_inheritance.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_wrap.py +0 -0
- {private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_slots_cycle.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.18
|
|
4
4
|
Summary: A Python package that provides a way to define private attributes in C++ implementation.
|
|
5
5
|
Home-page: https://github.com/Locked-chess-official/private_attribute_cpp
|
|
6
6
|
Author: HuangHaoHua
|
|
@@ -1120,41 +1120,67 @@ PrivateWrap_descrset(PyObject* obj, PyObject* name, PyObject* value) noexcept
|
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
1122
|
|
|
1123
|
+
static int
|
|
1124
|
+
PrivateWrap_traverse(PyObject* obj, visitproc visit, void* arg) noexcept
|
|
1125
|
+
{
|
|
1126
|
+
PrivateWrapObject* self = (PrivateWrapObject*)obj;
|
|
1127
|
+
if (self->result) {
|
|
1128
|
+
Py_VISIT(self->result);
|
|
1129
|
+
}
|
|
1130
|
+
if (self->func_list) {
|
|
1131
|
+
Py_VISIT(self->func_list);
|
|
1132
|
+
}
|
|
1133
|
+
return 0;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
static int
|
|
1137
|
+
PrivateWrap_clear(PyObject* obj) noexcept
|
|
1138
|
+
{
|
|
1139
|
+
PrivateWrapObject* self = (PrivateWrapObject*)obj;
|
|
1140
|
+
if (self->result) {
|
|
1141
|
+
Py_CLEAR(self->result);
|
|
1142
|
+
}
|
|
1143
|
+
if (self->func_list) {
|
|
1144
|
+
Py_CLEAR(self->func_list);
|
|
1145
|
+
}
|
|
1146
|
+
return 0;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1123
1149
|
static PyTypeObject PrivateWrapType = {
|
|
1124
1150
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
1125
|
-
"_PrivateWrap",
|
|
1126
|
-
sizeof(PrivateWrapObject),
|
|
1127
|
-
0,
|
|
1128
|
-
(destructor)PrivateWrap_dealloc,
|
|
1129
|
-
0,
|
|
1130
|
-
0,
|
|
1131
|
-
0,
|
|
1132
|
-
0,
|
|
1133
|
-
0,
|
|
1134
|
-
0,
|
|
1135
|
-
0,
|
|
1136
|
-
0,
|
|
1137
|
-
0,
|
|
1138
|
-
(ternaryfunc)PrivateWrap_call,
|
|
1139
|
-
0,
|
|
1140
|
-
PrivateWrap_getattro,
|
|
1141
|
-
0,
|
|
1142
|
-
0,
|
|
1143
|
-
Py_TPFLAGS_DEFAULT,
|
|
1144
|
-
"private_attribute._PrivateWrap",
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
0,
|
|
1148
|
-
0,
|
|
1149
|
-
0,
|
|
1150
|
-
0,
|
|
1151
|
-
0,
|
|
1152
|
-
PrivateWrap_members,
|
|
1153
|
-
PrivateWrap_getset,
|
|
1154
|
-
0,
|
|
1155
|
-
0,
|
|
1156
|
-
PrivateWrap_descrget,
|
|
1157
|
-
PrivateWrap_descrset,
|
|
1151
|
+
"_PrivateWrap", // tp_name
|
|
1152
|
+
sizeof(PrivateWrapObject), // tp_basicsize
|
|
1153
|
+
0, // tp_itemsize
|
|
1154
|
+
(destructor)PrivateWrap_dealloc, // tp_dealloc
|
|
1155
|
+
0, // tp_print
|
|
1156
|
+
0, // tp_getattr
|
|
1157
|
+
0, // tp_setattr
|
|
1158
|
+
0, // tp_reserved
|
|
1159
|
+
0, // tp_repr
|
|
1160
|
+
0, // tp_as_number
|
|
1161
|
+
0, // tp_as_sequence
|
|
1162
|
+
0, // tp_as_mapping
|
|
1163
|
+
0, // tp_hash
|
|
1164
|
+
(ternaryfunc)PrivateWrap_call, // tp_call
|
|
1165
|
+
0, // tp_str
|
|
1166
|
+
PrivateWrap_getattro, // tp_getattro
|
|
1167
|
+
0, // tp_setattro
|
|
1168
|
+
0, // tp_as_buffer
|
|
1169
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
|
|
1170
|
+
"private_attribute._PrivateWrap", // tp_doc
|
|
1171
|
+
PrivateWrap_traverse, // tp_traverse
|
|
1172
|
+
PrivateWrap_clear, // tp_clear
|
|
1173
|
+
0, // tp_richcompare
|
|
1174
|
+
0, // tp_weaklistoffset
|
|
1175
|
+
0, // tp_iter
|
|
1176
|
+
0, // tp_iternext
|
|
1177
|
+
0, // tp_methods
|
|
1178
|
+
PrivateWrap_members, // tp_members
|
|
1179
|
+
PrivateWrap_getset, // tp_getset
|
|
1180
|
+
0, // tp_base
|
|
1181
|
+
0, // tp_dict
|
|
1182
|
+
PrivateWrap_descrget, // tp_descr_get
|
|
1183
|
+
PrivateWrap_descrset, // tp_descr_set
|
|
1158
1184
|
};
|
|
1159
1185
|
|
|
1160
1186
|
static PrivateWrapObject*
|
|
@@ -1171,7 +1197,7 @@ PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list) noexcept
|
|
|
1171
1197
|
}
|
|
1172
1198
|
|
|
1173
1199
|
PrivateWrapObject *self =
|
|
1174
|
-
|
|
1200
|
+
PyObject_GC_New(PrivateWrapObject, &PrivateWrapType);
|
|
1175
1201
|
self->func_list = list;
|
|
1176
1202
|
Py_INCREF(list);
|
|
1177
1203
|
|
|
@@ -1207,7 +1233,7 @@ static PyObject*
|
|
|
1207
1233
|
PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /* kwgs */) noexcept
|
|
1208
1234
|
{
|
|
1209
1235
|
PyObject *func;
|
|
1210
|
-
if (!PyArg_ParseTuple(args, "O", &func)) return NULL;
|
|
1236
|
+
if (!PyArg_ParseTuple(args, "O:private_attribute.PrivateWrapProxy.__call__", &func)) return NULL;
|
|
1211
1237
|
if(PyObject_TypeCheck(func, &PrivateWrapType)) {
|
|
1212
1238
|
return (PyObject*)PrivateWrap_New(
|
|
1213
1239
|
self->decorator,
|
|
@@ -1262,6 +1288,22 @@ class MyClass(PrivateAttrBase):
|
|
|
1262
1288
|
```
|
|
1263
1289
|
)";
|
|
1264
1290
|
|
|
1291
|
+
static int
|
|
1292
|
+
PrivateWrapProxy_traverse(PrivateWrapProxyObject *self, visitproc visit, void *arg) noexcept
|
|
1293
|
+
{
|
|
1294
|
+
Py_VISIT(self->decorator);
|
|
1295
|
+
Py_VISIT(self->func_list);
|
|
1296
|
+
return 0;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
static int
|
|
1300
|
+
PrivateWrapProxy_clear(PrivateWrapProxyObject *self) noexcept
|
|
1301
|
+
{
|
|
1302
|
+
Py_CLEAR(self->decorator);
|
|
1303
|
+
Py_CLEAR(self->func_list);
|
|
1304
|
+
return 0;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1265
1307
|
static PyTypeObject PrivateWrapProxyType = {
|
|
1266
1308
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
1267
1309
|
"private_attribute.PrivateWrapProxy", // tp_name
|
|
@@ -1282,10 +1324,10 @@ static PyTypeObject PrivateWrapProxyType = {
|
|
|
1282
1324
|
0, // tp_getattro
|
|
1283
1325
|
0, // tp_setattro
|
|
1284
1326
|
0, // tp_as_buffer
|
|
1285
|
-
Py_TPFLAGS_DEFAULT
|
|
1327
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,// tp_flags
|
|
1286
1328
|
PrivateWrapProxy_doc, // tp_doc
|
|
1287
|
-
|
|
1288
|
-
|
|
1329
|
+
(traverseproc)PrivateWrapProxy_traverse,// tp_traverse
|
|
1330
|
+
(inquiry)PrivateWrapProxy_clear, // tp_clear
|
|
1289
1331
|
0, // tp_richcompare
|
|
1290
1332
|
0, // tp_weaklistoffset
|
|
1291
1333
|
0, // tp_iter
|
|
@@ -1310,7 +1352,7 @@ PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/) noe
|
|
|
1310
1352
|
PyObject *decorator;
|
|
1311
1353
|
PyObject *orig = NULL;
|
|
1312
1354
|
|
|
1313
|
-
if (!PyArg_ParseTuple(args, "O|O", &decorator, &orig))
|
|
1355
|
+
if (!PyArg_ParseTuple(args, "O|O:private_attribute.PrivateWrapProxy", &decorator, &orig))
|
|
1314
1356
|
return NULL;
|
|
1315
1357
|
|
|
1316
1358
|
self = (PrivateWrapProxyObject*)type->tp_alloc(type, 0);
|
|
@@ -2522,7 +2564,7 @@ need_analyse_type(PyObject* type) noexcept
|
|
|
2522
2564
|
}
|
|
2523
2565
|
|
|
2524
2566
|
static bool
|
|
2525
|
-
PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data) noexcept
|
|
2567
|
+
PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data, const std::string& func_name = "") noexcept
|
|
2526
2568
|
{
|
|
2527
2569
|
static const char* invalid_name[] = {"__private_attrs__", "__slots__", "__getattribute__", "__getattr__", "__init__",
|
|
2528
2570
|
"__setattr__", "__delattr__", "__name__", "__module__", "__doc__", "__getstate__", "__setstate__",
|
|
@@ -2534,7 +2576,11 @@ PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationDa
|
|
|
2534
2576
|
}
|
|
2535
2577
|
|
|
2536
2578
|
// only parse name, bases, attrs
|
|
2537
|
-
|
|
2579
|
+
std::string parse = "OOO";
|
|
2580
|
+
if (func_name.length() > 0) {
|
|
2581
|
+
parse += ":" + func_name;
|
|
2582
|
+
}
|
|
2583
|
+
if (!PyArg_ParseTuple(args, parse.c_str(), &data.name, &data.bases, &data.attrs)) {
|
|
2538
2584
|
return false;
|
|
2539
2585
|
}
|
|
2540
2586
|
Py_INCREF(data.name);
|
|
@@ -3069,7 +3115,7 @@ PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
|
|
|
3069
3115
|
PrivateAttrCreationData data;
|
|
3070
3116
|
PyObject* new_type = nullptr;
|
|
3071
3117
|
|
|
3072
|
-
if (!PrivateAttrType_preprocess(args, kwds, data)) {
|
|
3118
|
+
if (!PrivateAttrType_preprocess(args, kwds, data, "private_attribute.PrivateAttrType")) {
|
|
3073
3119
|
return nullptr;
|
|
3074
3120
|
}
|
|
3075
3121
|
|
|
@@ -3682,6 +3728,54 @@ PrivateTempObject_dealloc(PyObject* self) noexcept
|
|
|
3682
3728
|
Py_TYPE(self)->tp_free(self);
|
|
3683
3729
|
}
|
|
3684
3730
|
|
|
3731
|
+
static PyObject*
|
|
3732
|
+
PrivateTempObject_postprocess(PyObject* self, PyObject* type) noexcept
|
|
3733
|
+
{
|
|
3734
|
+
if (!PyType_Check(type)) {
|
|
3735
|
+
PyErr_SetString(PyExc_TypeError, "type must be a type");
|
|
3736
|
+
return NULL;
|
|
3737
|
+
}
|
|
3738
|
+
if ((((PrivateTempObject*)self)->tmp->cleared)) {
|
|
3739
|
+
PyErr_SetString(PyExc_RuntimeError, "temp not init or have been used");
|
|
3740
|
+
return NULL;
|
|
3741
|
+
}
|
|
3742
|
+
if (!PrivateAttrType_postprocess(type, *(((PrivateTempObject*)self)->tmp))) {
|
|
3743
|
+
return NULL;
|
|
3744
|
+
}
|
|
3745
|
+
((PrivateTempObject*)self)->tmp->clear();
|
|
3746
|
+
Py_RETURN_NONE;
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3749
|
+
static PyMethodDef PrivateTempObject_methods[] = {
|
|
3750
|
+
{"postprocess", (PyCFunction)PrivateTempObject_postprocess, METH_O, "postprocess the temp object"},
|
|
3751
|
+
{NULL}
|
|
3752
|
+
};
|
|
3753
|
+
|
|
3754
|
+
static int
|
|
3755
|
+
PrivateTempObject_traverse(PyObject* self, visitproc visit, void* arg) noexcept
|
|
3756
|
+
{
|
|
3757
|
+
PrivateTempObject* tmp = (PrivateTempObject*)self;
|
|
3758
|
+
if (tmp->tmp) {
|
|
3759
|
+
PrivateAttrCreationData* data = tmp->tmp;
|
|
3760
|
+
if (!data->cleared) {
|
|
3761
|
+
Py_VISIT(data->attrs_copy);
|
|
3762
|
+
Py_VISIT(data->base_kwds);
|
|
3763
|
+
Py_VISIT(data->attrs);
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
return 0;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
static int
|
|
3770
|
+
PrivateTempObject_clear(PyObject* self) noexcept
|
|
3771
|
+
{
|
|
3772
|
+
PrivateTempObject* tmp = (PrivateTempObject*)self;
|
|
3773
|
+
if (tmp->tmp && !tmp->tmp->cleared) {
|
|
3774
|
+
tmp->tmp->clear();
|
|
3775
|
+
}
|
|
3776
|
+
return 0;
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3685
3779
|
static PyTypeObject PrivateTempType = {
|
|
3686
3780
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
3687
3781
|
"private_attribute._PrivateTemp", // tp_name
|
|
@@ -3702,15 +3796,15 @@ static PyTypeObject PrivateTempType = {
|
|
|
3702
3796
|
0, //tp_getattro
|
|
3703
3797
|
0, //tp_setattro
|
|
3704
3798
|
0, //tp_as_buffer
|
|
3705
|
-
Py_TPFLAGS_DEFAULT, //tp_flags
|
|
3799
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, //tp_flags
|
|
3706
3800
|
0, //tp_doc
|
|
3707
|
-
|
|
3708
|
-
|
|
3801
|
+
PrivateTempObject_traverse, //tp_traverse
|
|
3802
|
+
PrivateTempObject_clear, //tp_clear
|
|
3709
3803
|
0, //tp_richcompare
|
|
3710
3804
|
0, //tp_weaklistoffset
|
|
3711
3805
|
0, //tp_iter
|
|
3712
3806
|
0, //tp_iternext
|
|
3713
|
-
|
|
3807
|
+
PrivateTempObject_methods, //tp_methods
|
|
3714
3808
|
0, //tp_members
|
|
3715
3809
|
PrivateTempObject_getsets //tp_getset
|
|
3716
3810
|
};
|
|
@@ -3719,12 +3813,12 @@ static PyObject*
|
|
|
3719
3813
|
prepare_for_PrivateAttr(PyObject* /*self*/, PyObject* args, PyObject* kwargs) noexcept
|
|
3720
3814
|
{
|
|
3721
3815
|
PrivateAttrCreationData* tmp_data = new PrivateAttrCreationData();
|
|
3722
|
-
if (!PrivateAttrType_preprocess(args, kwargs, *tmp_data)) {
|
|
3816
|
+
if (!PrivateAttrType_preprocess(args, kwargs, *tmp_data, "private_attribute.prepare")) {
|
|
3723
3817
|
tmp_data->clear();
|
|
3724
3818
|
delete tmp_data;
|
|
3725
3819
|
return NULL;
|
|
3726
3820
|
}
|
|
3727
|
-
PrivateTempObject* tmp =
|
|
3821
|
+
PrivateTempObject* tmp = PyObject_GC_New(PrivateTempObject, &PrivateTempType);
|
|
3728
3822
|
if (!tmp) {
|
|
3729
3823
|
tmp_data->clear();
|
|
3730
3824
|
delete tmp_data;
|
|
@@ -3742,19 +3836,7 @@ postprocess_for_PrivateAttr(PyObject* /*self*/, PyObject* args) noexcept
|
|
|
3742
3836
|
if (!PyArg_ParseTuple(args, "OO", &type, &tmp)) {
|
|
3743
3837
|
return NULL;
|
|
3744
3838
|
}
|
|
3745
|
-
|
|
3746
|
-
PyErr_SetString(PyExc_TypeError, "type must be a type");
|
|
3747
|
-
return NULL;
|
|
3748
|
-
}
|
|
3749
|
-
if (!PyObject_TypeCheck(tmp, &PrivateTempType)) {
|
|
3750
|
-
PyErr_SetString(PyExc_TypeError, "tmp must be a private_temp");
|
|
3751
|
-
return NULL;
|
|
3752
|
-
}
|
|
3753
|
-
if (!PrivateAttrType_postprocess(type, *(((PrivateTempObject*)tmp)->tmp))) {
|
|
3754
|
-
return NULL;
|
|
3755
|
-
}
|
|
3756
|
-
((PrivateTempObject*)tmp)->tmp->clear();
|
|
3757
|
-
Py_RETURN_NONE;
|
|
3839
|
+
return PrivateTempObject_postprocess(tmp, type);
|
|
3758
3840
|
}
|
|
3759
3841
|
|
|
3760
3842
|
#define METACLASS_WEAKREF_CALLBACK_REMOVE_ITEM(name) do {\
|
|
@@ -4122,7 +4204,7 @@ class PrivateAbcMeta(ABCMeta):
|
|
|
4122
4204
|
def __new__(cls, *args, **kwargs):
|
|
4123
4205
|
temp = private_attribute.prepare(*args, **kwargs)
|
|
4124
4206
|
typ = super().__new__(cls, temp.name, temp.bases, temp.attrs, **temp.kwds)
|
|
4125
|
-
private_attribute.postprocess(typ, temp)
|
|
4207
|
+
private_attribute.postprocess(typ, temp) # or temp.postprocess(typ)
|
|
4126
4208
|
return typ
|
|
4127
4209
|
|
|
4128
4210
|
private_attribute.register_metaclass(PrivateAbcMeta)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""A module that provides a metaclass for creating classes with private attributes.
|
|
2
|
-
Private attributes are defined in the `__private_attrs__` sequence and are only
|
|
3
|
-
You can use the `PrivateAttrBase`
|
|
2
|
+
Private attributes are defined in the `__private_attrs__` sequence and are only visitable in class codes.
|
|
3
|
+
You can use the `PrivateAttrBase` as the base class to create classes with private attributes.
|
|
4
4
|
The attributes which are private are not on the instance's `__dict__` and cannot be accessed outside
|
|
5
5
|
but in the methods defined in class it is reachable.
|
|
6
6
|
Usage example:
|
|
@@ -105,6 +105,7 @@ class _PrivateTemp:
|
|
|
105
105
|
def attrs(self) -> dict[str, Any]: ...
|
|
106
106
|
@property
|
|
107
107
|
def kwds(self) -> dict[str, Any]: ...
|
|
108
|
+
def postprocess(self, typ: type, /) -> None: ... # add in 2.1.17
|
|
108
109
|
|
|
109
110
|
def prepare(name: str, bases: tuple, attrs: _PrivateAttrDict, /, **kwds) -> _PrivateTemp:
|
|
110
111
|
"""
|
|
@@ -129,7 +130,7 @@ def prepare(name: str, bases: tuple, attrs: _PrivateAttrDict, /, **kwds) -> _Pri
|
|
|
129
130
|
def __new__(cls, *args, **kwargs):
|
|
130
131
|
temp = private_attribute.prepare(*args, **kwargs)
|
|
131
132
|
typ = super().__new__(cls, temp.name, temp.bases, temp.attrs, **temp.kwds)
|
|
132
|
-
private_attribute.postprocess(typ, temp)
|
|
133
|
+
private_attribute.postprocess(typ, temp) # or temp.postprocess(typ)
|
|
133
134
|
return typ
|
|
134
135
|
|
|
135
136
|
private_attribute.register_metaclass(PrivateAbcMeta)
|
|
@@ -160,7 +161,7 @@ def postprocess(typ: type, temp: _PrivateTemp, /) -> None:
|
|
|
160
161
|
def __new__(cls, *args, **kwargs):
|
|
161
162
|
temp = private_attribute.prepare(*args, **kwargs)
|
|
162
163
|
typ = super().__new__(cls, temp.name, temp.bases, temp.attrs, **temp.kwds)
|
|
163
|
-
private_attribute.postprocess(typ, temp)
|
|
164
|
+
private_attribute.postprocess(typ, temp) # or temp.postprocess(typ)
|
|
164
165
|
return typ
|
|
165
166
|
|
|
166
167
|
private_attribute.register_metaclass(PrivateAbcMeta)
|
|
@@ -190,7 +191,7 @@ def register_metaclass(typ: type, /) -> None:
|
|
|
190
191
|
def __new__(cls, *args, **kwargs):
|
|
191
192
|
temp = private_attribute.prepare(*args, **kwargs)
|
|
192
193
|
typ = super().__new__(cls, temp.name, temp.bases, temp.attrs, **temp.kwds)
|
|
193
|
-
private_attribute.postprocess(typ, temp)
|
|
194
|
+
private_attribute.postprocess(typ, temp) # or temp.postprocess(typ)
|
|
194
195
|
return typ
|
|
195
196
|
|
|
196
197
|
private_attribute.register_metaclass(PrivateAbcMeta)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.18
|
|
4
4
|
Summary: A Python package that provides a way to define private attributes in C++ implementation.
|
|
5
5
|
Home-page: https://github.com/Locked-chess-official/private_attribute_cpp
|
|
6
6
|
Author: HuangHaoHua
|
|
@@ -24,7 +24,7 @@ readme = open('README.md').read()
|
|
|
24
24
|
|
|
25
25
|
setup(
|
|
26
26
|
name='private_attribute_cpp',
|
|
27
|
-
version='2.1.
|
|
27
|
+
version='2.1.18',
|
|
28
28
|
author="HuangHaoHua",
|
|
29
29
|
author_email="13140752715@example.com",
|
|
30
30
|
description='A Python package that provides a way to define private attributes in C++ implementation.',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_attr_classify_owner.py
RENAMED
|
File without changes
|
{private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_class_private_attrs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{private_attribute_cpp-2.1.16 → private_attribute_cpp-2.1.18}/tests/test_private_inheritance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|