memorymanagement 1.4.3__tar.gz → 1.4.4__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.4.3 → memorymanagement-1.4.4}/PKG-INFO +1 -1
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/pointers/core.py +29 -20
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement.egg-info/PKG-INFO +1 -1
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/setup.cfg +1 -1
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/LICENSE +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/README.md +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/__init__.py +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/cleaning/__init__.py +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/cleaning/core.py +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/pointers/__init__.py +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement/pointers/decorators.py +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement.egg-info/SOURCES.txt +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement.egg-info/dependency_links.txt +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/memorymanagement.egg-info/top_level.txt +0 -0
- {memorymanagement-1.4.3 → memorymanagement-1.4.4}/pyproject.toml +0 -0
|
@@ -144,20 +144,25 @@ class Pointer(Generic[PT]):
|
|
|
144
144
|
else:
|
|
145
145
|
# Raise a "NameError"
|
|
146
146
|
raise NameError(f"Name \"{reference}\" is not defined")
|
|
147
|
-
# Else
|
|
147
|
+
# Else, if only a value is given an it is between the variables' frame's values
|
|
148
|
+
elif value and value in vars_dict.values():
|
|
149
|
+
# Loop for the variables' frame
|
|
150
|
+
for key,v in vars_dict.items():
|
|
151
|
+
# If the current value is the given value
|
|
152
|
+
if v is value:
|
|
153
|
+
# The current key is the reference
|
|
154
|
+
name=key
|
|
155
|
+
# Break
|
|
156
|
+
break
|
|
157
|
+
# Else (value not referenced)
|
|
148
158
|
else:
|
|
149
|
-
# Store every reference pointing to the given value
|
|
150
|
-
name=[key for key,v in vars_dict.items() if v is value]
|
|
151
|
-
# Set to "None" if no reference was found
|
|
152
|
-
name=name[0] if len(name)!=0 else None
|
|
153
|
-
# Store the reference in the hidden attribute "_name"
|
|
154
|
-
self._name=name
|
|
155
|
-
# If there is no reference
|
|
156
|
-
if self._name==None:
|
|
157
159
|
# Raise a "NameError"
|
|
158
|
-
raise NameError(f"No reference is pointing to given value \"{
|
|
160
|
+
raise NameError(f"No reference is pointing to given value \"{value}\" ({value.__class__.__name__})")
|
|
161
|
+
|
|
159
162
|
# Set argument "value" as the pointer's value
|
|
160
163
|
self._value=value
|
|
164
|
+
# Store the reference in the hidden attribute "_name"
|
|
165
|
+
self._name=name
|
|
161
166
|
|
|
162
167
|
# If there is an instance's attribute to point to and it doesn't belong to the given value
|
|
163
168
|
if attr and attr not in dir(value):
|
|
@@ -238,16 +243,16 @@ class Pointer(Generic[PT]):
|
|
|
238
243
|
else:
|
|
239
244
|
# Raise a "NameError"
|
|
240
245
|
raise NameError(f"Name \"{reference}\" is not defined")
|
|
241
|
-
# Else
|
|
242
|
-
|
|
243
|
-
#
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
# Else, if only a value is given an it is between the variables' frame's values
|
|
247
|
+
elif value and value in self._vars_dict:
|
|
248
|
+
# Loop for the variables' frame
|
|
249
|
+
for key,v in self._vars_dict.items():
|
|
250
|
+
# If the current value is the given value
|
|
251
|
+
if v is value:
|
|
252
|
+
# The current key is the reference and the given value is set as pointer's value
|
|
253
|
+
self._name,self._value=key,value
|
|
254
|
+
# Break
|
|
255
|
+
break
|
|
251
256
|
# If an instance's attribute name is given
|
|
252
257
|
if attr:
|
|
253
258
|
# If the attribute belongs to the new value
|
|
@@ -258,6 +263,10 @@ class Pointer(Generic[PT]):
|
|
|
258
263
|
else:
|
|
259
264
|
# Raise an "AttributeError"
|
|
260
265
|
raise AttributeError(f"\"{attr}\" is not an attribute of \"{self._value}\"")
|
|
266
|
+
# Else (value not referenced)
|
|
267
|
+
else:
|
|
268
|
+
# Raise a "NameError"
|
|
269
|
+
raise NameError(f"No reference is pointing to given value \"{self._value}\"")
|
|
261
270
|
|
|
262
271
|
# Get references
|
|
263
272
|
def get_refs(self)->tuple[str]:
|
|
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.4.3 → memorymanagement-1.4.4}/memorymanagement.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|