cutienator 0.0.1.dev0__py3-none-any.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.
- cutienator/__init__.py +44 -0
- cutienator/_cpp_addr.py +84 -0
- cutienator/_cpp_box.py +23 -0
- cutienator/_cute_load_hook.py +159 -0
- cutienator/_cute_mixin.py +166 -0
- cutienator/_cute_overload.py +285 -0
- cutienator/_cute_space.py +727 -0
- cutienator/_header_descriptor.py +4 -0
- cutienator/_meta_cute.py +444 -0
- cutienator/_q_binding_storage.py +101 -0
- cutienator/_q_event.py +185 -0
- cutienator/_q_meta_object.py +118 -0
- cutienator/_q_object.py +582 -0
- cutienator/_q_thread.py +106 -0
- cutienator/_q_widget.py +80 -0
- cutienator/_ugly.py +296 -0
- cutienator/_wait.py +303 -0
- cutienator/_waiting_overload.py +261 -0
- cutienator/example/__init__.py +21 -0
- cutienator/example/__main__.py +67 -0
- cutienator/example/_calls.py +107 -0
- cutienator/occult/__init__.py +27 -0
- cutienator/occult/__main__.py +50 -0
- cutienator/occult/_base_meta_ugly.py +29 -0
- cutienator/occult/_build.py +561 -0
- cutienator/occult/_cognito_warning.py +35 -0
- cutienator/occult/_declaration.py +572 -0
- cutienator/occult/_header.py +710 -0
- cutienator/occult/_ritual.py +19 -0
- cutienator/occult/_rituals.py +594 -0
- cutienator/occult/_shared_object.py +292 -0
- cutienator/occult/_symbol.py +162 -0
- cutienator/occult/rituals/q_event.cpp +70 -0
- cutienator/occult/rituals/q_meta_object.cpp +173 -0
- cutienator/occult/rituals/q_object.cpp +178 -0
- cutienator/trial/__init__.py +25 -0
- cutienator/trial/__main__.py +59 -0
- cutienator/trial/_judge.py +589 -0
- cutienator/trial/_q_object_trials.py +38 -0
- cutienator/trial/_trial.py +495 -0
- cutienator/trial/_verdict.py +332 -0
- cutienator-0.0.1.dev0.dist-info/METADATA +33 -0
- cutienator-0.0.1.dev0.dist-info/RECORD +46 -0
- cutienator-0.0.1.dev0.dist-info/WHEEL +5 -0
- cutienator-0.0.1.dev0.dist-info/licenses/LICENSE +201 -0
- cutienator-0.0.1.dev0.dist-info/top_level.txt +1 -0
cutienator/_meta_cute.py
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MetaCute provides the general 'metaclass' for the 'cutienator' library.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from worktoy.mcls import BaseMeta
|
|
11
|
+
from worktoy.waitaminute import TypeException
|
|
12
|
+
|
|
13
|
+
from . import WAIT, CuteSpace
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
16
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
17
|
+
|
|
18
|
+
WaitingField = Tuple[type, str, WAIT]
|
|
19
|
+
Family = List[Tuple[type, CuteSpace]]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MetaCute(BaseMeta):
|
|
23
|
+
"""
|
|
24
|
+
MetaCute provides the general 'metaclass' for the 'cutienator' library.
|
|
25
|
+
It makes every cute class, and so it is the one place that sees each
|
|
26
|
+
of them the moment it exists. It uses that for one job so far:
|
|
27
|
+
settling the classes that wait for a class made later. See 'WAIT' for
|
|
28
|
+
the whole story; this is step 1, 5 and 6 of it.
|
|
29
|
+
|
|
30
|
+
class QObject(CuteMixin, metaclass=MetaCute):
|
|
31
|
+
QThread = WAIT['QThread']
|
|
32
|
+
...
|
|
33
|
+
|
|
34
|
+
MetaCute.getStillWaiting() # ('QThread',)
|
|
35
|
+
|
|
36
|
+
class QThread(QObject): # 'MetaCute' notices this one
|
|
37
|
+
...
|
|
38
|
+
|
|
39
|
+
MetaCute.getStillWaiting() # ()
|
|
40
|
+
|
|
41
|
+
Terms
|
|
42
|
+
-----
|
|
43
|
+
|
|
44
|
+
- A late class, a waiting class and a waiting signature are as 'WAIT'
|
|
45
|
+
explains them.
|
|
46
|
+
- A waiting field is one 'WAIT' in the body of a waiting class,
|
|
47
|
+
together with that class and the name it is bound to: 'QObject',
|
|
48
|
+
'QThread', and the 'WAIT' at 'QObject.QThread'.
|
|
49
|
+
- To settle a waiting field is to do, once its late class is made,
|
|
50
|
+
what the waiting class could not do when it was made itself.
|
|
51
|
+
- A dispatcher is the one object worktoy puts at an overloaded name,
|
|
52
|
+
which picks the function for each call.
|
|
53
|
+
|
|
54
|
+
You provide
|
|
55
|
+
-----------
|
|
56
|
+
|
|
57
|
+
Nothing here. You write 'metaclass=MetaCute' on a cute class that is
|
|
58
|
+
built on no other cute class, and the 'WAIT' lines in the bodies.
|
|
59
|
+
|
|
60
|
+
What it does
|
|
61
|
+
------------
|
|
62
|
+
|
|
63
|
+
- '__prepare__' gives the body of every cute class a 'CuteSpace' to
|
|
64
|
+
run in.
|
|
65
|
+
- 'addWaiting' takes note of a waiting field. The 'WAIT' calls it
|
|
66
|
+
itself, as its class is made.
|
|
67
|
+
- '__init__' runs each time a cute class has just been made. It notes
|
|
68
|
+
the class down by its name, and settles every waiting field whose
|
|
69
|
+
late class is now on the list. For one waiting field that is:
|
|
70
|
+
1. The late class is put at the name of the waiting class, in the
|
|
71
|
+
place of the 'WAIT': 'QObject.QThread' is 'QThread' from now on.
|
|
72
|
+
2. The 'CuteSpace' of the waiting class puts the signatures that
|
|
73
|
+
waited for it back on record, each where it was written.
|
|
74
|
+
3. The dispatcher of each name that got a signature back is built
|
|
75
|
+
again and placed, on the waiting class and on every class built
|
|
76
|
+
on it so far, since each class has dispatchers of its own.
|
|
77
|
+
|
|
78
|
+
What to expect
|
|
79
|
+
--------------
|
|
80
|
+
|
|
81
|
+
- One list of waiting fields and one list of made classes serve every
|
|
82
|
+
cute class in the program, also the classes of a metaclass based on
|
|
83
|
+
this one.
|
|
84
|
+
- A class is recognised by its name alone, as its '__name__'. Two
|
|
85
|
+
cute classes of one name are not told apart: the one made last is
|
|
86
|
+
the one a later 'WAIT' is settled with.
|
|
87
|
+
- A 'WAIT' for a class that is made already is settled right as its
|
|
88
|
+
waiting class is made.
|
|
89
|
+
- 'getStillWaiting' names what is waited for and not made. After
|
|
90
|
+
every cute class of a program is imported it should be empty.
|
|
91
|
+
- A dispatcher built again replaces the one that was there. A method
|
|
92
|
+
that was read off an object before, and kept, still goes by the old
|
|
93
|
+
one.
|
|
94
|
+
- Settling is all or nothing. When one waiting field cannot be
|
|
95
|
+
settled, as when its class has two functions at what becomes one
|
|
96
|
+
signature, the class statement that was running fails, and that
|
|
97
|
+
class is not noted as made. The faulty field is given up. Every
|
|
98
|
+
other field keeps waiting, untouched, and is settled when the class
|
|
99
|
+
is written again.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
103
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
104
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
105
|
+
|
|
106
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
107
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
108
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
109
|
+
|
|
110
|
+
# Class Variables
|
|
111
|
+
|
|
112
|
+
# Fallback Variables
|
|
113
|
+
|
|
114
|
+
# Private Variables
|
|
115
|
+
# Kept on 'MetaCute' itself and read off it by name, so a metaclass
|
|
116
|
+
# based on this one shares them. For each late class by name, the
|
|
117
|
+
# waiting fields that wait for it.
|
|
118
|
+
__waiting_fields__: Optional[Dict[str, List[WaitingField]]] = None
|
|
119
|
+
# Every cute class made so far, by name.
|
|
120
|
+
__made_classes__: Optional[Dict[str, type]] = None
|
|
121
|
+
|
|
122
|
+
# Public Variables
|
|
123
|
+
|
|
124
|
+
# Virtual Variables
|
|
125
|
+
|
|
126
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
127
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
128
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
129
|
+
|
|
130
|
+
@classmethod
|
|
131
|
+
def _getWaitingFields(mcls) -> Dict[str, List[WaitingField]]:
|
|
132
|
+
"""Gives the one list of waiting fields, making it if need be."""
|
|
133
|
+
if MetaCute.__waiting_fields__ is None:
|
|
134
|
+
MetaCute.__waiting_fields__ = dict()
|
|
135
|
+
return MetaCute.__waiting_fields__
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def _getMadeClasses(mcls) -> Dict[str, type]:
|
|
139
|
+
"""Gives the one list of cute classes made, making it if need be."""
|
|
140
|
+
if MetaCute.__made_classes__ is None:
|
|
141
|
+
MetaCute.__made_classes__ = dict()
|
|
142
|
+
return MetaCute.__made_classes__
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def getStillWaiting(mcls) -> Tuple[str, ...]:
|
|
146
|
+
"""
|
|
147
|
+
Gives the name of every late class that some cute class waits for
|
|
148
|
+
and that is not made yet, in alphabetical order.
|
|
149
|
+
|
|
150
|
+
Found for you, from the waiting fields noted by 'addWaiting' and
|
|
151
|
+
not yet settled. Ask it after importing every cute class of a
|
|
152
|
+
program: a name left then is a class that was promised by a 'WAIT'
|
|
153
|
+
and never written, or written under another name.
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
|
|
158
|
+
Tuple[str, ...]
|
|
159
|
+
The names, as ('QThread',). It is empty when nothing waits.
|
|
160
|
+
"""
|
|
161
|
+
waitingFields = mcls._getWaitingFields()
|
|
162
|
+
return (*sorted(name for name in waitingFields if waitingFields[name]),)
|
|
163
|
+
|
|
164
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
165
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
166
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def addWaiting(
|
|
170
|
+
mcls,
|
|
171
|
+
waitingClass: type,
|
|
172
|
+
fieldName: str,
|
|
173
|
+
wait: WAIT,
|
|
174
|
+
) -> None:
|
|
175
|
+
"""
|
|
176
|
+
Takes note that a cute class waits for a late class.
|
|
177
|
+
|
|
178
|
+
Called by the 'WAIT' itself, from 'WAIT.hookSetName', as its class
|
|
179
|
+
is made. You never call it. The waiting field is settled by
|
|
180
|
+
'__init__': at once when the late class is made already, otherwise
|
|
181
|
+
when it is made.
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
|
|
186
|
+
waitingClass : type
|
|
187
|
+
The class whose body holds the 'WAIT'.
|
|
188
|
+
|
|
189
|
+
fieldName : str
|
|
190
|
+
The name the 'WAIT' is bound to in that body.
|
|
191
|
+
|
|
192
|
+
wait : WAIT
|
|
193
|
+
The 'WAIT'. It knows the name of the late class.
|
|
194
|
+
|
|
195
|
+
Raises
|
|
196
|
+
------
|
|
197
|
+
|
|
198
|
+
TypeException
|
|
199
|
+
'waitingClass' is no class, 'fieldName' no text, or 'wait' no
|
|
200
|
+
'WAIT'.
|
|
201
|
+
"""
|
|
202
|
+
if not isinstance(waitingClass, type):
|
|
203
|
+
raise TypeException('waitingClass', waitingClass, type)
|
|
204
|
+
if not isinstance(fieldName, str):
|
|
205
|
+
raise TypeException('fieldName', fieldName, str)
|
|
206
|
+
if not isinstance(wait, WAIT):
|
|
207
|
+
raise TypeException('wait', wait, WAIT)
|
|
208
|
+
waitingFields = mcls._getWaitingFields()
|
|
209
|
+
waitingFor = waitingFields.setdefault(wait.getWaitingName(), [])
|
|
210
|
+
waitingFor.append((waitingClass, fieldName, wait))
|
|
211
|
+
|
|
212
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
213
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
214
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
215
|
+
|
|
216
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
217
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
218
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
219
|
+
|
|
220
|
+
@classmethod
|
|
221
|
+
def __prepare__(mcls, name: str, bases: tuple, **kwargs) -> CuteSpace:
|
|
222
|
+
"""
|
|
223
|
+
Gives the namespace the body of a cute class runs in: a new
|
|
224
|
+
'CuteSpace'.
|
|
225
|
+
|
|
226
|
+
Python calls this at every class statement of a cute class, before
|
|
227
|
+
the body runs. You never call it.
|
|
228
|
+
"""
|
|
229
|
+
return CuteSpace(mcls, name, bases, **kwargs)
|
|
230
|
+
|
|
231
|
+
def __init__(cls, name: str, bases: tuple, space: Any, **kwargs) -> None:
|
|
232
|
+
"""
|
|
233
|
+
Runs when a cute class has just been made, and settles every
|
|
234
|
+
waiting field whose late class is now made.
|
|
235
|
+
|
|
236
|
+
Python calls this at the end of every class statement of a cute
|
|
237
|
+
class. You never call it. First worktoy does all it does for any
|
|
238
|
+
class. Then the class is noted down by its name, and each waiting
|
|
239
|
+
field whose late class is on the list is settled. That covers both
|
|
240
|
+
ways round: the fields of other classes that waited for this one,
|
|
241
|
+
and the fields of this class waiting for a class made before it.
|
|
242
|
+
|
|
243
|
+
When any of that raises, the class statement fails, and the lists
|
|
244
|
+
are left as if it had never run: the class is not noted as made,
|
|
245
|
+
and its own waiting fields are forgotten. See '_settleReady' for
|
|
246
|
+
what becomes of the waiting fields of other classes.
|
|
247
|
+
|
|
248
|
+
Parameters
|
|
249
|
+
----------
|
|
250
|
+
|
|
251
|
+
name : str
|
|
252
|
+
The name of the class just made.
|
|
253
|
+
|
|
254
|
+
bases : tuple
|
|
255
|
+
The classes it is built on, as the class statement names them.
|
|
256
|
+
|
|
257
|
+
space : Any
|
|
258
|
+
The 'CuteSpace' its body ran in.
|
|
259
|
+
"""
|
|
260
|
+
mcls = type(cls)
|
|
261
|
+
madeClasses = mcls._getMadeClasses()
|
|
262
|
+
madeBefore = madeClasses.get(name, None)
|
|
263
|
+
try:
|
|
264
|
+
super().__init__(name, bases, space, **kwargs)
|
|
265
|
+
madeClasses[name] = cls
|
|
266
|
+
mcls._settleReady()
|
|
267
|
+
except BaseException:
|
|
268
|
+
if madeBefore is None:
|
|
269
|
+
madeClasses.pop(name, None)
|
|
270
|
+
else:
|
|
271
|
+
madeClasses[name] = madeBefore
|
|
272
|
+
mcls._forgetClass(cls)
|
|
273
|
+
raise
|
|
274
|
+
|
|
275
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
276
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
277
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
278
|
+
|
|
279
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
280
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
281
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
282
|
+
|
|
283
|
+
@classmethod
|
|
284
|
+
def _settleReady(mcls) -> None:
|
|
285
|
+
"""
|
|
286
|
+
Settles every waiting field whose late class is made: all of them,
|
|
287
|
+
or none.
|
|
288
|
+
|
|
289
|
+
It goes in two rounds. In the first, the 'CuteSpace' of each
|
|
290
|
+
waiting class puts its signatures back on record. That is the one
|
|
291
|
+
step that can be refused: worktoy raises 'DuplicateSignature' when
|
|
292
|
+
two functions end up at one signature. In the second round the late
|
|
293
|
+
class is put at each field and the dispatchers are built again,
|
|
294
|
+
which nothing refuses.
|
|
295
|
+
|
|
296
|
+
When the first round is refused for one waiting field, every
|
|
297
|
+
namespace changed so far is put back as it was, that one field is
|
|
298
|
+
given up, and the refusal is raised, so the class statement that
|
|
299
|
+
was running fails. No class has been touched by then. The other
|
|
300
|
+
fields keep waiting, whichever order they were noted in, and are
|
|
301
|
+
settled when the class is written again. The field given up is
|
|
302
|
+
never settled: the refusal named its fault.
|
|
303
|
+
|
|
304
|
+
Raises
|
|
305
|
+
------
|
|
306
|
+
|
|
307
|
+
DuplicateSignature
|
|
308
|
+
A signature put back equals one its waiting class already has for
|
|
309
|
+
another function.
|
|
310
|
+
|
|
311
|
+
TypeException
|
|
312
|
+
A waiting class, or a class built on it, has a namespace that is
|
|
313
|
+
no 'CuteSpace'. That takes a metaclass based on this one that
|
|
314
|
+
prepares another namespace.
|
|
315
|
+
"""
|
|
316
|
+
madeClasses = mcls._getMadeClasses()
|
|
317
|
+
ready = [] # type: List[Tuple[str, WaitingField]]
|
|
318
|
+
for lateName, waitingFor in mcls._getWaitingFields().items():
|
|
319
|
+
if lateName in madeClasses:
|
|
320
|
+
ready.extend((lateName, waitingField) for waitingField in waitingFor)
|
|
321
|
+
named = [] # type: List[Tuple[Any, ...]]
|
|
322
|
+
for lateName, waitingField in ready:
|
|
323
|
+
waitingClass, fieldName, wait = waitingField
|
|
324
|
+
try:
|
|
325
|
+
family = mcls._getFamily(waitingClass)
|
|
326
|
+
space = family[0][1]
|
|
327
|
+
records = space.keepRecords()
|
|
328
|
+
methodNames = space.nameLateClass(wait, madeClasses[lateName])
|
|
329
|
+
except BaseException as exception:
|
|
330
|
+
for _, _, namedFamily, _, namedRecords in reversed(named):
|
|
331
|
+
namedFamily[0][1].restoreRecords(namedRecords)
|
|
332
|
+
if isinstance(exception, Exception):
|
|
333
|
+
mcls._dropWaiting(lateName, waitingField)
|
|
334
|
+
raise
|
|
335
|
+
named.append((lateName, waitingField, family, methodNames, records))
|
|
336
|
+
for lateName, waitingField, family, methodNames, _ in named:
|
|
337
|
+
waitingClass, fieldName, _ = waitingField
|
|
338
|
+
mcls._dropWaiting(lateName, waitingField)
|
|
339
|
+
type.__setattr__(waitingClass, fieldName, madeClasses[lateName])
|
|
340
|
+
mcls._buildAgain(family, methodNames)
|
|
341
|
+
|
|
342
|
+
@classmethod
|
|
343
|
+
def _dropWaiting(mcls, lateName: str, waitingField: WaitingField) -> None:
|
|
344
|
+
"""Takes one waiting field off the list: it is settled, or given up."""
|
|
345
|
+
waitingFields = mcls._getWaitingFields()
|
|
346
|
+
waitingFor = waitingFields.get(lateName, [])
|
|
347
|
+
for index, held in enumerate(waitingFor):
|
|
348
|
+
if held is waitingField:
|
|
349
|
+
del waitingFor[index]
|
|
350
|
+
break
|
|
351
|
+
if not waitingFor:
|
|
352
|
+
waitingFields.pop(lateName, None)
|
|
353
|
+
|
|
354
|
+
@classmethod
|
|
355
|
+
def _forgetClass(mcls, cuteClass: type) -> None:
|
|
356
|
+
"""Takes every waiting field of one class off the list: it was never
|
|
357
|
+
made, since its class statement failed."""
|
|
358
|
+
waitingFields = mcls._getWaitingFields()
|
|
359
|
+
for lateName in [*waitingFields]:
|
|
360
|
+
for waitingField in [*waitingFields[lateName]]:
|
|
361
|
+
if waitingField[0] is cuteClass:
|
|
362
|
+
mcls._dropWaiting(lateName, waitingField)
|
|
363
|
+
|
|
364
|
+
@classmethod
|
|
365
|
+
def _getFamily(mcls, cuteClass: type) -> Family:
|
|
366
|
+
"""
|
|
367
|
+
Gives a class and every class built on it so far, each with the
|
|
368
|
+
'CuteSpace' its body ran in. The class itself comes first, and a
|
|
369
|
+
class always comes after the one it is built on.
|
|
370
|
+
|
|
371
|
+
Parameters
|
|
372
|
+
----------
|
|
373
|
+
|
|
374
|
+
cuteClass : type
|
|
375
|
+
The class to start at.
|
|
376
|
+
|
|
377
|
+
Raises
|
|
378
|
+
------
|
|
379
|
+
|
|
380
|
+
TypeException
|
|
381
|
+
One of them has a namespace that is no 'CuteSpace', so nothing
|
|
382
|
+
kept its waiting signatures and nothing can build its dispatchers
|
|
383
|
+
again.
|
|
384
|
+
"""
|
|
385
|
+
space = cuteClass.getNamespace()
|
|
386
|
+
if not isinstance(space, CuteSpace):
|
|
387
|
+
raise TypeException('space', space, CuteSpace)
|
|
388
|
+
family = [(cuteClass, space)]
|
|
389
|
+
for subclass in type.__subclasses__(cuteClass):
|
|
390
|
+
for member in mcls._getFamily(subclass):
|
|
391
|
+
if all(member[0] is not held[0] for held in family):
|
|
392
|
+
family.append(member)
|
|
393
|
+
return family
|
|
394
|
+
|
|
395
|
+
@classmethod
|
|
396
|
+
def _buildAgain(
|
|
397
|
+
mcls,
|
|
398
|
+
family: Family,
|
|
399
|
+
methodNames: Tuple[str, ...],
|
|
400
|
+
) -> None:
|
|
401
|
+
"""
|
|
402
|
+
Builds the dispatchers of some names again and places them, on a
|
|
403
|
+
class and on every class built on it so far.
|
|
404
|
+
|
|
405
|
+
A class that defines one of the names plainly in its own body keeps
|
|
406
|
+
that definition, as it did when it was made: a plain definition
|
|
407
|
+
hides the overloads behind it.
|
|
408
|
+
|
|
409
|
+
Parameters
|
|
410
|
+
----------
|
|
411
|
+
|
|
412
|
+
family : Family
|
|
413
|
+
The waiting class and the classes built on it, as '_getFamily'
|
|
414
|
+
gave them.
|
|
415
|
+
|
|
416
|
+
methodNames : Tuple[str, ...]
|
|
417
|
+
The names that got a signature back, as 'CuteSpace.nameLateClass'
|
|
418
|
+
gave them.
|
|
419
|
+
"""
|
|
420
|
+
for cuteClass, space in family:
|
|
421
|
+
for methodName in methodNames:
|
|
422
|
+
if dict.__contains__(space, methodName):
|
|
423
|
+
continue
|
|
424
|
+
dispatcher = space.cuteLoadHook.buildAgain(methodName)
|
|
425
|
+
if dispatcher is None:
|
|
426
|
+
continue
|
|
427
|
+
type.__setattr__(cuteClass, methodName, dispatcher)
|
|
428
|
+
dispatcher.__set_name__(cuteClass, methodName)
|
|
429
|
+
|
|
430
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
431
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
432
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
433
|
+
|
|
434
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
435
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
436
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
437
|
+
|
|
438
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
439
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
440
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
441
|
+
|
|
442
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
443
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
444
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QBindingStorage binding of the Qt C++, so far in name only.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from ._cute_mixin import CuteMixin
|
|
9
|
+
from ._meta_cute import MetaCute
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class QBindingStorage(CuteMixin, metaclass=MetaCute):
|
|
13
|
+
"""
|
|
14
|
+
The cute side of Qt's QBindingStorage, so far in name only. It
|
|
15
|
+
exists because 'QObject.bindingStorage()' gives one back, and a cute
|
|
16
|
+
function can only give back an object of a cute class.
|
|
17
|
+
|
|
18
|
+
storage = QObject().bindingStorage() # a QBindingStorage
|
|
19
|
+
|
|
20
|
+
What exists so far
|
|
21
|
+
------------------
|
|
22
|
+
|
|
23
|
+
Nothing of its own: no function of Qt's QBindingStorage is reflected
|
|
24
|
+
yet, and none can be made from Python. One comes out of
|
|
25
|
+
'QObject.bindingStorage()' and can be held and compared, no more.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
29
|
+
# STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
30
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
31
|
+
|
|
32
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
33
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
34
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
35
|
+
|
|
36
|
+
# Class Variables
|
|
37
|
+
|
|
38
|
+
# Fallback Variables
|
|
39
|
+
|
|
40
|
+
# Private Variables
|
|
41
|
+
|
|
42
|
+
# Public Variables
|
|
43
|
+
|
|
44
|
+
# Virtual Variables
|
|
45
|
+
|
|
46
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
47
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
48
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
49
|
+
|
|
50
|
+
def _createUglySide(self, ) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Refuses: no ritual makes a C++ QBindingStorage yet, so
|
|
53
|
+
'QBindingStorage()' has nothing to stand for. One is given by
|
|
54
|
+
'QObject.bindingStorage()'.
|
|
55
|
+
|
|
56
|
+
Raises
|
|
57
|
+
------
|
|
58
|
+
|
|
59
|
+
TypeError
|
|
60
|
+
Always.
|
|
61
|
+
"""
|
|
62
|
+
infoSpec = """A 'QBindingStorage' cannot be made from Python yet:
|
|
63
|
+
there is no ritual for its constructor. One is given by
|
|
64
|
+
'QObject.bindingStorage()'."""
|
|
65
|
+
raise TypeError(' '.join(infoSpec.split()))
|
|
66
|
+
|
|
67
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
68
|
+
# SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
69
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
70
|
+
|
|
71
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
72
|
+
# NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
73
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
74
|
+
|
|
75
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
76
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
77
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
78
|
+
|
|
79
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
80
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
81
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
82
|
+
|
|
83
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
84
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
85
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
86
|
+
|
|
87
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
88
|
+
# OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
89
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
90
|
+
|
|
91
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
92
|
+
# REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
93
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
94
|
+
|
|
95
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
96
|
+
# PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
97
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
98
|
+
|
|
99
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
100
|
+
# PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
101
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|