memorymanagement 1.2.2__tar.gz → 1.2.3__tar.gz
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-1.2.2 → memorymanagement-1.2.3}/PKG-INFO +1 -1
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/cleaning/core.py +17 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement.egg-info/PKG-INFO +1 -1
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/setup.cfg +1 -1
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/LICENSE +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/README.md +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/__init__.py +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/cleaning/__init__.py +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/pointers/__init__.py +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/pointers/core.py +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement/pointers/decorators.py +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement.egg-info/SOURCES.txt +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement.egg-info/dependency_links.txt +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement.egg-info/top_level.txt +0 -0
- {memorymanagement-1.2.2 → memorymanagement-1.2.3}/pyproject.toml +0 -0
|
@@ -45,6 +45,7 @@ class Cleaner:
|
|
|
45
45
|
Returns the list of variables to be erased from memory.
|
|
46
46
|
None of this properties has setter or deleter. Those lists can only be manipulated through the class methods.
|
|
47
47
|
"""
|
|
48
|
+
|
|
48
49
|
def __init__(self,not_delete:list[str]|None=None,excluded:list[str]=[],flagged:list[str]=[]):
|
|
49
50
|
"""
|
|
50
51
|
Initializes the class instance.\n
|
|
@@ -68,6 +69,7 @@ class Cleaner:
|
|
|
68
69
|
self._excluded=excluded.copy()
|
|
69
70
|
self._flagged=flagged.copy()
|
|
70
71
|
self._name=None
|
|
72
|
+
|
|
71
73
|
def update(self,exclude:str|list[str]|tuple[str]|None=None,include:str|list[str]|tuple[str]|None=None):
|
|
72
74
|
"""
|
|
73
75
|
Flags all the new global variables' references that were not manually excluded here or before.
|
|
@@ -92,6 +94,7 @@ class Cleaner:
|
|
|
92
94
|
while var in self._excluded:
|
|
93
95
|
self._excluded.remove(var)
|
|
94
96
|
self._flagged=[var for var in list(vars(modules["__main__"]))if var not in self.not_delete and var not in self.excluded]
|
|
97
|
+
|
|
95
98
|
@property
|
|
96
99
|
def not_delete(self):
|
|
97
100
|
if not self._name or vars(modules["__main__"])[self._name] is not self:
|
|
@@ -107,12 +110,15 @@ class Cleaner:
|
|
|
107
110
|
elif self._name not in self._not_delete:
|
|
108
111
|
self._not_delete.append(self._name)
|
|
109
112
|
return self._not_delete
|
|
113
|
+
|
|
110
114
|
@property
|
|
111
115
|
def excluded(self):
|
|
112
116
|
return self._excluded
|
|
117
|
+
|
|
113
118
|
@property
|
|
114
119
|
def flagged(self):
|
|
115
120
|
return self._flagged
|
|
121
|
+
|
|
116
122
|
def exclude(self,*exclude:str):
|
|
117
123
|
"""
|
|
118
124
|
Allows to exclude the desired references from the cleaning process.
|
|
@@ -127,6 +133,7 @@ class Cleaner:
|
|
|
127
133
|
self._flagged.remove(var)
|
|
128
134
|
if var not in self._excluded:
|
|
129
135
|
self._excluded.append(var)
|
|
136
|
+
|
|
130
137
|
def include(self,*include:str):
|
|
131
138
|
"""
|
|
132
139
|
Allows to include the desired references (previously excluded) in the cleaning process.
|
|
@@ -141,6 +148,7 @@ class Cleaner:
|
|
|
141
148
|
self._flagged.append(var)
|
|
142
149
|
while var in self._excluded:
|
|
143
150
|
self._excluded.remove(var)
|
|
151
|
+
|
|
144
152
|
def clean(self):
|
|
145
153
|
"""
|
|
146
154
|
Culminates the cleaning process.
|
|
@@ -150,6 +158,14 @@ class Cleaner:
|
|
|
150
158
|
if var in list(vars(modules["__main__"])):
|
|
151
159
|
del vars(modules["__main__"])[var]
|
|
152
160
|
self._flagged.clear()
|
|
161
|
+
|
|
162
|
+
def purge(self):
|
|
163
|
+
"""
|
|
164
|
+
Clears both `flagged` and `excluded` lists from the `Cleaner` object.
|
|
165
|
+
"""
|
|
166
|
+
self._flagged.clear()
|
|
167
|
+
self._excluded.clear()
|
|
168
|
+
|
|
153
169
|
def __str__(self):
|
|
154
170
|
string=f"""
|
|
155
171
|
Flagged: {self.flagged}
|
|
@@ -159,5 +175,6 @@ class Cleaner:
|
|
|
159
175
|
Not delete: {self.not_delete}
|
|
160
176
|
"""
|
|
161
177
|
return string
|
|
178
|
+
|
|
162
179
|
def __repr__(self):
|
|
163
180
|
return f"{self.__class__.__name__}(not_delete={self.not_delete},excluded={self.excluded},flagged={self.flagged})"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{memorymanagement-1.2.2 → memorymanagement-1.2.3}/memorymanagement.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|