memorymanagement 1.1.1__py3-none-any.whl → 1.1.2__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.
- memorymanagement/cleaning/core.py +7 -6
- memorymanagement/pointers/core.py +1 -0
- {memorymanagement-1.1.1.dist-info → memorymanagement-1.1.2.dist-info}/METADATA +1 -1
- memorymanagement-1.1.2.dist-info/RECORD +11 -0
- memorymanagement-1.1.1.dist-info/RECORD +0 -11
- {memorymanagement-1.1.1.dist-info → memorymanagement-1.1.2.dist-info}/WHEEL +0 -0
- {memorymanagement-1.1.1.dist-info → memorymanagement-1.1.2.dist-info}/licenses/LICENSE +0 -0
- {memorymanagement-1.1.1.dist-info → memorymanagement-1.1.2.dist-info}/top_level.txt +0 -0
|
@@ -42,7 +42,7 @@ class Cleaner:
|
|
|
42
42
|
Returns the list of variables to be erased from memory.
|
|
43
43
|
None of this properties has setter or deleter. Those lists can only be manipulated through the class methods.
|
|
44
44
|
"""
|
|
45
|
-
def __init__(self,not_delete:list[str]=
|
|
45
|
+
def __init__(self,not_delete:list[str]|None=None,excluded:list[str]=[],flagged:list[str]=[]):
|
|
46
46
|
"""
|
|
47
47
|
Initializes the class instance.\n
|
|
48
48
|
It is recommended to initialize the instance right after all global imports at the beggining of the program so no argument is needed.
|
|
@@ -53,13 +53,14 @@ class Cleaner:
|
|
|
53
53
|
excluded (`list[str]`, Optional): List of variables to be excluded from the memory cleaning process. Empty list by default.
|
|
54
54
|
flagged (`list[str]`, Optional): List of variables to be erased from memory. Empty list by default.
|
|
55
55
|
"""
|
|
56
|
+
if not not_delete:
|
|
57
|
+
not_delete=list(vars(modules["__main__"]))
|
|
56
58
|
for key,value in vars(modules["__main__"]).copy().items():
|
|
57
59
|
if isinstance(value,Cleaner) and key in vars(modules["__main__"]).keys():
|
|
58
60
|
del vars(modules["__main__"])[key]
|
|
59
61
|
self._not_delete=not_delete.copy()
|
|
60
62
|
self._excluded=excluded.copy()
|
|
61
63
|
self._flagged=flagged.copy()
|
|
62
|
-
return
|
|
63
64
|
def update(self,exclude:str|list[str]|tuple[str]|None=None,include:str|list[str]|tuple[str]|None=None):
|
|
64
65
|
"""
|
|
65
66
|
Flags all the new global variables' references that were not manually excluded here or before. You can also include previously excluded references.
|
|
@@ -82,7 +83,10 @@ class Cleaner:
|
|
|
82
83
|
while var in self._excluded:
|
|
83
84
|
self._excluded.remove(var)
|
|
84
85
|
self._flagged=[var for var in list(vars(modules["__main__"])) if var not in self._not_delete and var not in self._excluded]
|
|
85
|
-
|
|
86
|
+
for var in self._flagged.copy():
|
|
87
|
+
if isinstance(vars(modules["__main__"])[var],Cleaner):
|
|
88
|
+
self._flagged.remove(var)
|
|
89
|
+
self._not_delete.append(var)
|
|
86
90
|
@property
|
|
87
91
|
def not_delete(self):
|
|
88
92
|
return self._not_delete
|
|
@@ -105,7 +109,6 @@ class Cleaner:
|
|
|
105
109
|
self._flagged.remove(var)
|
|
106
110
|
if var not in self._excluded:
|
|
107
111
|
self._excluded.append(var)
|
|
108
|
-
return
|
|
109
112
|
def include(self,*include:str):
|
|
110
113
|
"""
|
|
111
114
|
Allows to include the desired references (previously excluded) in the cleaning process.
|
|
@@ -119,7 +122,6 @@ class Cleaner:
|
|
|
119
122
|
self._flagged.append(var)
|
|
120
123
|
while var in self._excluded:
|
|
121
124
|
self._excluded.remove(var)
|
|
122
|
-
return
|
|
123
125
|
def clean(self):
|
|
124
126
|
"""
|
|
125
127
|
Culminates the cleaning process. Erases all the flagged references.
|
|
@@ -128,7 +130,6 @@ class Cleaner:
|
|
|
128
130
|
if var in list(vars(modules["__main__"])):
|
|
129
131
|
del vars(modules["__main__"])[var]
|
|
130
132
|
self._flagged.clear()
|
|
131
|
-
return
|
|
132
133
|
def __str__(self):
|
|
133
134
|
string=f"""
|
|
134
135
|
Flagged: {self.flagged}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#*===============================================================================================================================
|
|
2
2
|
#* LEGEND
|
|
3
|
+
#*-------------------------------------------------------------------------------------------------------------------------------
|
|
3
4
|
#! Missing
|
|
4
5
|
#? Question
|
|
5
6
|
#* Section
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
memorymanagement/__init__.py,sha256=Clyt9uUH0DZW36BdmWCMYNg4R2uLYYsSdsn1UgeLSJs,816
|
|
2
|
+
memorymanagement/cleaning/__init__.py,sha256=zC6dWTCTP6b-E3_Q7L45i2ZK_5DrVBbjzKT2AFuXdJk,1359
|
|
3
|
+
memorymanagement/cleaning/core.py,sha256=rddAHsg81lAjujxZo_j5FDQPqKU7f3Ha2vWoXjI5K6g,6720
|
|
4
|
+
memorymanagement/pointers/__init__.py,sha256=MmQnt8KtC2GTHuc-JIypjeyc_iWHJsQTvQdwZPilF34,734
|
|
5
|
+
memorymanagement/pointers/core.py,sha256=aMttcolo_IruqtwhIbKsD1Ygu4b7NJN-pRQURIBLC-o,11969
|
|
6
|
+
memorymanagement/pointers/decorators.py,sha256=NDMlexU6s123jPU0Tqny8HkMdtPsfwrzVAgjCAYpy4A,2869
|
|
7
|
+
memorymanagement-1.1.2.dist-info/licenses/LICENSE,sha256=oomqnX6WpwczxhGg1lDAUrS13YL-0NFIpomyReHWgKo,1098
|
|
8
|
+
memorymanagement-1.1.2.dist-info/METADATA,sha256=2fglFFjl19VFr_bMhQ2ITu2CRtGRn-o6RJMyJr8AdW0,4941
|
|
9
|
+
memorymanagement-1.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
memorymanagement-1.1.2.dist-info/top_level.txt,sha256=7SwrpC3BY9Cm6sqwu082DJE5SteRBira0LGqziTO7eQ,17
|
|
11
|
+
memorymanagement-1.1.2.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
memorymanagement/__init__.py,sha256=Clyt9uUH0DZW36BdmWCMYNg4R2uLYYsSdsn1UgeLSJs,816
|
|
2
|
-
memorymanagement/cleaning/__init__.py,sha256=zC6dWTCTP6b-E3_Q7L45i2ZK_5DrVBbjzKT2AFuXdJk,1359
|
|
3
|
-
memorymanagement/cleaning/core.py,sha256=ya_mxI9gJDmq3zR7Y6Dw8aPQOBkMLVDNECT4X6bCke4,6539
|
|
4
|
-
memorymanagement/pointers/__init__.py,sha256=MmQnt8KtC2GTHuc-JIypjeyc_iWHJsQTvQdwZPilF34,734
|
|
5
|
-
memorymanagement/pointers/core.py,sha256=5r8MmaEQIiqa8C6d_SfaUNEnFBptNtlOBhR9gG8HTJU,11838
|
|
6
|
-
memorymanagement/pointers/decorators.py,sha256=NDMlexU6s123jPU0Tqny8HkMdtPsfwrzVAgjCAYpy4A,2869
|
|
7
|
-
memorymanagement-1.1.1.dist-info/licenses/LICENSE,sha256=oomqnX6WpwczxhGg1lDAUrS13YL-0NFIpomyReHWgKo,1098
|
|
8
|
-
memorymanagement-1.1.1.dist-info/METADATA,sha256=QiYHxnEzDN-al-WoUx5QWsdHt9mGMCyxMHhYCpON97g,4941
|
|
9
|
-
memorymanagement-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
memorymanagement-1.1.1.dist-info/top_level.txt,sha256=7SwrpC3BY9Cm6sqwu082DJE5SteRBira0LGqziTO7eQ,17
|
|
11
|
-
memorymanagement-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|