pyobjc-framework-CoreData 12.2__cp315-cp315t-macosx_10_15_universal2.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.
CoreData/__init__.py ADDED
@@ -0,0 +1,55 @@
1
+ """
2
+ Python mapping for the CoreData framework.
3
+
4
+ This module does not contain docstrings for the wrapped code, check Apple's
5
+ documentation for details on how to use these functions and classes.
6
+ """
7
+
8
+
9
+ def _setup():
10
+ import sys
11
+
12
+ import Foundation
13
+ import objc
14
+ from . import _metadata, _CoreData
15
+
16
+ dir_func, getattr_func = objc.createFrameworkDirAndGetattr(
17
+ name="CoreData",
18
+ frameworkIdentifier="com.apple.CoreData",
19
+ frameworkPath=objc.pathForFramework(
20
+ "/System/Library/Frameworks/CoreData.framework"
21
+ ),
22
+ globals_dict=globals(),
23
+ inline_list=None,
24
+ parents=(
25
+ _CoreData,
26
+ Foundation,
27
+ ),
28
+ metadict=_metadata.__dict__,
29
+ )
30
+
31
+ globals()["__dir__"] = dir_func
32
+ globals()["__getattr__"] = getattr_func
33
+
34
+ for cls, sel in (
35
+ ("NSLightweightMigrationStage", b"init"),
36
+ ("NSPersistentCloudKitContainerEvent", b"init"),
37
+ ("NSPersistentCloudKitContainerEvent", b"new"),
38
+ ("NSPersistentCloudKitContainerOptions", b"init"),
39
+ ("NSCoreDataCoreSpotlightDelegate", b"init"),
40
+ ("NSManagedObjectModelReference", b"init"),
41
+ ("NSStagedMigrationManager", b"init"),
42
+ ("NSBatchDeleteRequest", b"init"),
43
+ ("NSPersistentCloudKitContainerEventResult", b"init"),
44
+ ("NSPersistentCloudKitContainerEventResult", b"new"),
45
+ ("NSPersistentStore", b"init"),
46
+ ("NSMergeConflict", b"init"),
47
+ ("NSMergePolicy", b"init"),
48
+ ("NSCustomMigrationStage", b"init"),
49
+ ):
50
+ objc.registerUnavailableMethod(cls, sel)
51
+
52
+ del sys.modules["CoreData._metadata"]
53
+
54
+
55
+ globals().pop("_setup")()
@@ -0,0 +1,63 @@
1
+ """
2
+ This adds some useful conveniences to NSManagedObject and subclasses thereof
3
+
4
+ These conveniences try to enable KVO by default on NSManagedObject instances,
5
+ this no longer works on Leopard due to the way NSManagedObject is implemented
6
+ there (it generates accessor methods at runtime, which interferes with the
7
+ implementation in this file).
8
+ """
9
+
10
+ __all__ = ()
11
+ import os
12
+
13
+ from Foundation import NSObject
14
+ from objc import addConvenienceForClass, super # noqa: A004
15
+
16
+ # XXX: This is fairly crude, need further research.
17
+ # This code basically tries to outsmart tricks that
18
+ # CoreData plays, and that's asking for problems.
19
+ if os.uname()[2] < "13.":
20
+
21
+ def _first_python(cls):
22
+ if "__objc_python_subclass__" in cls.__dict__:
23
+ return cls
24
+ return None
25
+
26
+ else:
27
+
28
+ def _first_python(cls):
29
+ for cls in cls.mro(): # noqa: B020
30
+ if "__objc_python_subclass__" in cls.__dict__:
31
+ return cls
32
+ return None
33
+
34
+
35
+ def NSMOsetValue_ForKey_(self, name, value):
36
+ try:
37
+ first = _first_python(self.__class__)
38
+ if first is not None:
39
+ super(first, self).setValue_forKey_(value, name)
40
+ else:
41
+ self.setValue_forKey_(value, name)
42
+
43
+ except KeyError:
44
+ NSObject.__setattr__(self, name, value)
45
+
46
+
47
+ def NSMOgetValueForKey_(self, name):
48
+ try:
49
+ first = _first_python(self.__class__)
50
+ if first is not None:
51
+ return super(first, self).valueForKey_(name)
52
+ else:
53
+ return self.valueForKey_(name)
54
+
55
+ except KeyError:
56
+ raise AttributeError(name)
57
+
58
+
59
+ if os.uname()[2] < "13.":
60
+ addConvenienceForClass(
61
+ "NSManagedObject",
62
+ (("__setattr__", NSMOsetValue_ForKey_), ("__getattr__", NSMOgetValueForKey_)),
63
+ )