kenenet 0.0.7__py3-none-any.whl → 0.0.9__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.
- kenenet/__init__.py +11 -30
- {kenenet-0.0.7.dist-info → kenenet-0.0.9.dist-info}/METADATA +1 -1
- kenenet-0.0.9.dist-info/RECORD +5 -0
- kenenet-0.0.7.dist-info/RECORD +0 -5
- {kenenet-0.0.7.dist-info → kenenet-0.0.9.dist-info}/WHEEL +0 -0
- {kenenet-0.0.7.dist-info → kenenet-0.0.9.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -1,40 +1,21 @@
|
|
1
1
|
import inspect, sys
|
2
2
|
|
3
|
-
|
4
|
-
def get_defined_objects():
|
5
|
-
current_module = sys.modules[__name__]
|
6
|
-
objects = {}
|
7
|
-
|
8
|
-
for name, obj in globals().items():
|
9
|
-
# Ignore built-in functions and modules
|
10
|
-
if name.startswith("__") or inspect.ismodule(obj):
|
11
|
-
continue
|
12
|
-
|
13
|
-
# Ignore imported objects (they will have a different module)
|
14
|
-
if hasattr(obj, "__module__") and obj.__module__ != current_module.__name__:
|
15
|
-
continue
|
16
|
-
|
17
|
-
# Ignore objects defined inside functions (nested scope)
|
18
|
-
if inspect.isfunction(obj) and obj.__qualname__ != obj.__name__:
|
19
|
-
continue
|
20
|
-
if inspect.isclass(obj) and "." in obj.__qualname__:
|
21
|
-
continue
|
22
|
-
|
23
|
-
objects[name] = obj
|
24
|
-
|
25
|
-
return objects
|
26
|
-
|
27
|
-
|
28
3
|
def adding(a, b):
|
29
4
|
return a + b
|
30
5
|
|
6
|
+
def subtracting(a, b):
|
7
|
+
return a - b
|
8
|
+
|
31
9
|
class k:
|
32
10
|
pass
|
33
11
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
12
|
+
# Automatically attach all global functions to class k,
|
13
|
+
# filtering out any that start with an underscore (like __init__)
|
14
|
+
current_module = sys.modules[__name__]
|
15
|
+
for name, func in inspect.getmembers(current_module, inspect.isfunction):
|
16
|
+
if not name.startswith('_'):
|
17
|
+
setattr(k, name, func)
|
38
18
|
|
19
|
+
# Optional: update __main__ if needed
|
39
20
|
if '__main__' in sys.modules:
|
40
|
-
sys.modules['__main__'].__dict__['k'] = k
|
21
|
+
sys.modules['__main__'].__dict__['k'] = k
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=cyx5bMAIW8nut4ypoPkhpiKwmt0kRtfXOrXVij3BtXU,552
|
2
|
+
kenenet-0.0.9.dist-info/METADATA,sha256=w7TWDhyTVyi8l_jjY_fdVC6cVZQyXfBIwVTcpM3FtW4,513
|
3
|
+
kenenet-0.0.9.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
+
kenenet-0.0.9.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-0.0.9.dist-info/RECORD,,
|
kenenet-0.0.7.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=OVeAx14NtCQqgiZjUpACdA1AAXxA0iTRfcmBEAwzJdU,1063
|
2
|
-
kenenet-0.0.7.dist-info/METADATA,sha256=_qt0RP5kyaz-yjmoTllwJxsVrlO-Ki5LvhyXQQ28KCE,513
|
3
|
-
kenenet-0.0.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
-
kenenet-0.0.7.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-0.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|