private-attribute-cpp 1.2.1__cp312-cp312-win32.whl → 1.2.5__cp312-cp312-win32.whl
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.cp312-win32.pyd +0 -0
- private_attribute.pyi +3 -3
- {private_attribute_cpp-1.2.1.dist-info → private_attribute_cpp-1.2.5.dist-info}/METADATA +9 -11
- private_attribute_cpp-1.2.5.dist-info/RECORD +6 -0
- private_attribute_cpp-1.2.1.dist-info/RECORD +0 -6
- {private_attribute_cpp-1.2.1.dist-info → private_attribute_cpp-1.2.5.dist-info}/WHEEL +0 -0
- {private_attribute_cpp-1.2.1.dist-info → private_attribute_cpp-1.2.5.dist-info}/top_level.txt +0 -0
|
Binary file
|
private_attribute.pyi
CHANGED
|
@@ -11,7 +11,7 @@ class _PrivateWrap[T]:
|
|
|
11
11
|
def result(self) -> T: ...
|
|
12
12
|
|
|
13
13
|
class PrivateWrapProxy:
|
|
14
|
-
def __init__(self, decorator: Callable[[Any], T], orig: _PrivateWrap|None = None, /) -> None: ...
|
|
14
|
+
def __init__(self, decorator: Callable[[Any], T], orig: _PrivateWrap[Any]|None = None, /) -> None: ...
|
|
15
15
|
def __call__(self, func: Any) -> _PrivateWrap[T]: ...
|
|
16
16
|
|
|
17
17
|
class PrivateAttrType(type):
|
|
@@ -28,10 +28,10 @@ class private_temp:
|
|
|
28
28
|
@property
|
|
29
29
|
def bases(self) -> tuple[type]: ...
|
|
30
30
|
@property
|
|
31
|
-
def attrs(self) ->
|
|
31
|
+
def attrs(self) -> dict[str, Any]: ...
|
|
32
32
|
@property
|
|
33
33
|
def kwds(self) -> dict[str, Any]: ...
|
|
34
34
|
|
|
35
|
-
def prepare(name, bases, attrs, **kwds) -> private_temp: ...
|
|
35
|
+
def prepare(name: str, bases: tuple, attrs: PrivateAttrDict, **kwds) -> private_temp: ...
|
|
36
36
|
def postprocess(typ: type, temp: private_temp) -> None: ...
|
|
37
37
|
def register_metaclass(typ: type) -> None: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
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
|
|
@@ -68,11 +68,11 @@ print(obj.expensive_api_call(10)) # works with all decorators applied
|
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
| # | API | Purpose | Required? |
|
|
71
|
-
|
|
71
|
+
| --- | ---------------------------------------- | ------------------------------------------------------- | ----------- |
|
|
72
72
|
| 1 | PrivateAttrBase | Base class – must inherit | Yes |
|
|
73
|
-
| 1 | PrivateWrapProxy
|
|
74
|
-
| 2 | private_func=callable
|
|
75
|
-
| 3 | Pass private_func in class definition | Same as above
|
|
73
|
+
| 1 | PrivateWrapProxy | Decorator wrapper for arbitrary decorators | When needed |
|
|
74
|
+
| 2 | private_func=callable | Custom hidden-name generator | Optional |
|
|
75
|
+
| 3 | Pass private_func in class definition | Same as above | Optional |
|
|
76
76
|
| 4 | \_\_private_attrs\_\_ list | Declare which attributes are private | Yes |
|
|
77
77
|
| 5 | @PrivateWrapProxy(...) | Make any decorator compatible with private attributes | When needed |
|
|
78
78
|
| 6 | method.result.xxx chain + dummy wrap | Fix decorator order and name conflicts | When needed |
|
|
@@ -138,8 +138,7 @@ class MyClass(PrivateAttrBase):
|
|
|
138
138
|
def method1(self):
|
|
139
139
|
...
|
|
140
140
|
|
|
141
|
-
@method1.attr_name
|
|
142
|
-
@PrivateWrapProxy(lambda _: _) # use empty function to wrap
|
|
141
|
+
@PrivateWrapProxy(method1.attr_name, method1) # Use the argument "method1" to save old func
|
|
143
142
|
def method1(self):
|
|
144
143
|
...
|
|
145
144
|
|
|
@@ -147,8 +146,7 @@ class MyClass(PrivateAttrBase):
|
|
|
147
146
|
def method2(self):
|
|
148
147
|
...
|
|
149
148
|
|
|
150
|
-
@method2.attr_name
|
|
151
|
-
@PrivateWrapProxy(lambda _: _)
|
|
149
|
+
@PrivateWrapProxy(method2.attr_name, method2) # Use the argument "method2" to save old func
|
|
152
150
|
def method2(self):
|
|
153
151
|
...
|
|
154
152
|
|
|
@@ -194,7 +192,7 @@ import private_attribute
|
|
|
194
192
|
class PrivateAbcMeta(ABCMeta):
|
|
195
193
|
def __new__(cls, name, bases, attrs, **kwargs):
|
|
196
194
|
temp = private_attribute.prepare(name, bases, attrs, **kwargs)
|
|
197
|
-
typ = super().__new__(cls, temp.name, temp.
|
|
195
|
+
typ = super().__new__(cls, temp.name, temp.bases, temp.attrs, **temp.kwds)
|
|
198
196
|
private_attribute.postprocess(typ, temp)
|
|
199
197
|
return typ
|
|
200
198
|
|
|
@@ -256,7 +254,7 @@ MIT
|
|
|
256
254
|
|
|
257
255
|
## Requirement
|
|
258
256
|
|
|
259
|
-
This package require the c++ module "picosha2" to compute the sha256 hash.
|
|
257
|
+
This package require the c++ module "[picosha2](https://github.com/okdshin/PicoSHA2)" to compute the sha256 hash.
|
|
260
258
|
|
|
261
259
|
## Support
|
|
262
260
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
private_attribute.cp312-win32.pyd,sha256=yOPova9HxFs9m43w-Guvziumr7VIaSfIZW1ZGqs5CjU,145920
|
|
2
|
+
private_attribute.pyi,sha256=TSPoWQkiCXiBz6mEPok1MFJDsCPPvmB3YhvyPpiXxRk,1256
|
|
3
|
+
private_attribute_cpp-1.2.5.dist-info/METADATA,sha256=U79KaMG8geNcZNxDacOv2Ht4oUardJMGMA82l41FpMw,8940
|
|
4
|
+
private_attribute_cpp-1.2.5.dist-info/WHEEL,sha256=JQV-xY5E6RTZnUqfqfY1oq4KqhknSvUaAcZOOtrKwyw,98
|
|
5
|
+
private_attribute_cpp-1.2.5.dist-info/top_level.txt,sha256=vOfJKfFO3AgjCIvyK6ppYDBTyJSsEAkf5w34knGZ3JE,19
|
|
6
|
+
private_attribute_cpp-1.2.5.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
private_attribute.cp312-win32.pyd,sha256=pl35VEUGQjYM9UVS_V5uKsWSz_tbzD37dgNiKvhHEjA,144896
|
|
2
|
-
private_attribute.pyi,sha256=f-C03v19ws4k7Tx21f6kVc7C7cEwlaqfXN8cqVDj6Vo,1223
|
|
3
|
-
private_attribute_cpp-1.2.1.dist-info/METADATA,sha256=Qc3__t7xASANLjAf7XZ1w3jL2SWp9u96qMtqfaYilXg,8853
|
|
4
|
-
private_attribute_cpp-1.2.1.dist-info/WHEEL,sha256=JQV-xY5E6RTZnUqfqfY1oq4KqhknSvUaAcZOOtrKwyw,98
|
|
5
|
-
private_attribute_cpp-1.2.1.dist-info/top_level.txt,sha256=vOfJKfFO3AgjCIvyK6ppYDBTyJSsEAkf5w34knGZ3JE,19
|
|
6
|
-
private_attribute_cpp-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
{private_attribute_cpp-1.2.1.dist-info → private_attribute_cpp-1.2.5.dist-info}/top_level.txt
RENAMED
|
File without changes
|